<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 4.0.0">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/logo.svg" color="#222">

<link rel="stylesheet" href="/css/main.css">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.5.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    copycode: {"enable":false,"show_result":false,"style":null},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
    bookmark: {"enable":false,"color":"#222","save":"auto"},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: '',
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    },
    sidebarPadding: 40
  };
</script>

  <meta name="description" content="1import pandas as pd   12chipo = pd.read_csv(&amp;apos;chipotle.tsv&amp;apos;,sep=&amp;apos;\t&amp;apos;)chipo.head()           .dataframe tbody tr th:only-of-type {         vertical-align: middle;     }  .dataframe tbody tr th {     ve">
<meta property="og:type" content="article">
<meta property="og:title" content="exercise">
<meta property="og:url" content="https:&#x2F;&#x2F;fwj1635387072.github.io&#x2F;2021&#x2F;03&#x2F;31&#x2F;exercise&#x2F;index.html">
<meta property="og:site_name" content="付文杰的博客">
<meta property="og:description" content="1import pandas as pd   12chipo = pd.read_csv(&amp;apos;chipotle.tsv&amp;apos;,sep=&amp;apos;\t&amp;apos;)chipo.head()           .dataframe tbody tr th:only-of-type {         vertical-align: middle;     }  .dataframe tbody tr th {     ve">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https:&#x2F;&#x2F;fwj1635387072.github.io&#x2F;2021&#x2F;03&#x2F;31&#x2F;exercise&#x2F;output_65_0.png">
<meta property="og:image" content="https:&#x2F;&#x2F;fwj1635387072.github.io&#x2F;2021&#x2F;03&#x2F;31&#x2F;exercise&#x2F;output_66_1.png">
<meta property="og:image" content="https:&#x2F;&#x2F;fwj1635387072.github.io&#x2F;2021&#x2F;03&#x2F;31&#x2F;exercise&#x2F;output_68_0.png">
<meta property="og:updated_time" content="2021-03-31T11:49:08.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https:&#x2F;&#x2F;fwj1635387072.github.io&#x2F;2021&#x2F;03&#x2F;31&#x2F;exercise&#x2F;output_65_0.png">

<link rel="canonical" href="https://fwj1635387072.github.io/2021/03/31/exercise/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>


  <title>exercise | 付文杰的博客</title>
  






  <noscript>
  <style>
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-header { opacity: initial; }

  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container use-motion">
    <div class="headband"></div>

    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-container">
  <div class="site-meta">

    <div>
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">付文杰的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">个人博客  |  日常</p>
  </div>

  <div class="site-nav-toggle">
    <div class="toggle" aria-label="切换导航栏">
      <span class="toggle-line toggle-line-first"></span>
      <span class="toggle-line toggle-line-middle"></span>
      <span class="toggle-line toggle-line-last"></span>
    </div>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
        <li class="menu-item menu-item-home">

    <a href="/" rel="section"><i class="fa fa-fw fa-home"></i>首页</a>

  </li>
        <li class="menu-item menu-item-tags">

    <a href="/tags/" rel="section"><i class="fa fa-fw fa-tags"></i>标签</a>

  </li>
        <li class="menu-item menu-item-categories">

    <a href="/categories/" rel="section"><i class="fa fa-fw fa-th"></i>分类</a>

  </li>
        <li class="menu-item menu-item-archives">

    <a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>归档</a>

  </li>
  </ul>

</nav>

      </div>
    </header>

    
  <div class="back-to-top">
    <i class="fa fa-arrow-up"></i>
    <span>0%</span>
  </div>


    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          

          <div class="content">
            

  <div class="posts-expand">
      
  
  
  <article itemscope itemtype="http://schema.org/Article" class="post-block " lang="zh-CN">
    <link itemprop="mainEntityOfPage" href="https://FWj1635387072.github.io/2021/03/31/exercise/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="image" content="/images/headImage.jpg">
      <meta itemprop="name" content="付文杰">
      <meta itemprop="description" content="兰州交通大学 | 本科生 <br> 信息管理与信息系统">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="付文杰的博客">
    </span>
      <header class="post-header">
        <h1 class="post-title" itemprop="name headline">
          exercise
        </h1>

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              

              <time title="创建时间：2021-03-31 19:50:27 / 修改时间：19:49:08" itemprop="dateCreated datePublished" datetime="2021-03-31T19:50:27+08:00">2021-03-31</time>
            </span>

          <br>
            <span class="post-meta-item" title="本文字数">
              <span class="post-meta-item-icon">
                <i class="fa fa-file-word-o"></i>
              </span>
                <span class="post-meta-item-text">本文字数：</span>
              <span>32k</span>
            </span>
            <span class="post-meta-item" title="阅读时长">
              <span class="post-meta-item-icon">
                <i class="fa fa-clock-o"></i>
              </span>
                <span class="post-meta-item-text">阅读时长 &asymp;</span>
              <span>53 分钟</span>
            </span>

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">chipo = pd.read_csv(<span class="string">'chipotle.tsv'</span>,sep=<span class="string">'\t'</span>)</span><br><span class="line">chipo.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>order_id</th>
      <th>quantity</th>
      <th>item_name</th>
      <th>choice_description</th>
      <th>item_price</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1</td>
      <td>1</td>
      <td>Chips and Fresh Tomato Salsa</td>
      <td>NaN</td>
      <td>$2.39</td>
    </tr>
    <tr>
      <th>1</th>
      <td>1</td>
      <td>1</td>
      <td>Izze</td>
      <td>[Clementine]</td>
      <td>$3.39</td>
    </tr>
    <tr>
      <th>2</th>
      <td>1</td>
      <td>1</td>
      <td>Nantucket Nectar</td>
      <td>[Apple]</td>
      <td>$3.39</td>
    </tr>
    <tr>
      <th>3</th>
      <td>1</td>
      <td>1</td>
      <td>Chips and Tomatillo-Green Chili Salsa</td>
      <td>NaN</td>
      <td>$2.39</td>
    </tr>
    <tr>
      <th>4</th>
      <td>2</td>
      <td>2</td>
      <td>Chicken Bowl</td>
      <td>[Tomatillo-Red Chili Salsa (Hot), [Black Beans...</td>
      <td>$16.98</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chipo.shape[<span class="number">0</span>]</span><br></pre></td></tr></table></figure>




<pre><code>4622</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chipo.columns</span><br></pre></td></tr></table></figure>




<pre><code>Index([&apos;order_id&apos;, &apos;quantity&apos;, &apos;item_name&apos;, &apos;choice_description&apos;,
       &apos;item_price&apos;],
      dtype=&apos;object&apos;)</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chipo.index</span><br></pre></td></tr></table></figure>




<pre><code>RangeIndex(start=0, stop=4622, step=1)</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chipo[<span class="string">'item_name'</span>].nunique()</span><br></pre></td></tr></table></figure>




<pre><code>50</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chipo[<span class="string">'choice_description'</span>].value_counts().head(<span class="number">1</span>)</span><br></pre></td></tr></table></figure>




<pre><code>[Diet Coke]    134
Name: choice_description, dtype: int64</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">chipo[<span class="string">'quantity'</span>].sum()</span><br></pre></td></tr></table></figure>




<pre><code>4972</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">dollarizer = <span class="keyword">lambda</span> x:float(x[<span class="number">1</span>:<span class="number">-1</span>])</span><br><span class="line">chipo[<span class="string">'item_price'</span>] = chipo[<span class="string">'item_price'</span>].apply(dollarizer)</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">chipo[<span class="string">'sub_total'</span>] = round(chipo[<span class="string">'item_price'</span>] * chipo[<span class="string">'quantity'</span>],<span class="number">2</span>)</span><br><span class="line">chipo.head(<span class="number">10</span>)</span><br><span class="line">chipo[<span class="string">'sub_total'</span>].sum()</span><br></pre></td></tr></table></figure>




<pre><code>39237.02</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#欧洲杯数据(练习二)</span></span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line">euro12 = pd.read_csv(<span class="string">'Euro2012_stats.csv'</span>)</span><br><span class="line"></span><br><span class="line">euro12.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Goals</th>
      <th>Shots on target</th>
      <th>Shots off target</th>
      <th>Shooting Accuracy</th>
      <th>% Goals-to-shots</th>
      <th>Total shots (inc. Blocked)</th>
      <th>Hit Woodwork</th>
      <th>Penalty goals</th>
      <th>Penalties not scored</th>
      <th>...</th>
      <th>Saves made</th>
      <th>Saves-to-shots ratio</th>
      <th>Fouls Won</th>
      <th>Fouls Conceded</th>
      <th>Offsides</th>
      <th>Yellow Cards</th>
      <th>Red Cards</th>
      <th>Subs on</th>
      <th>Subs off</th>
      <th>Players Used</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Croatia</td>
      <td>4</td>
      <td>13</td>
      <td>12</td>
      <td>51.9%</td>
      <td>16.0%</td>
      <td>32</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>13</td>
      <td>81.3%</td>
      <td>41</td>
      <td>62</td>
      <td>2</td>
      <td>9</td>
      <td>0</td>
      <td>9</td>
      <td>9</td>
      <td>16</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Czech Republic</td>
      <td>4</td>
      <td>13</td>
      <td>18</td>
      <td>41.9%</td>
      <td>12.9%</td>
      <td>39</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>9</td>
      <td>60.1%</td>
      <td>53</td>
      <td>73</td>
      <td>8</td>
      <td>7</td>
      <td>0</td>
      <td>11</td>
      <td>11</td>
      <td>19</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Denmark</td>
      <td>4</td>
      <td>10</td>
      <td>10</td>
      <td>50.0%</td>
      <td>20.0%</td>
      <td>27</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>10</td>
      <td>66.7%</td>
      <td>25</td>
      <td>38</td>
      <td>8</td>
      <td>4</td>
      <td>0</td>
      <td>7</td>
      <td>7</td>
      <td>15</td>
    </tr>
    <tr>
      <th>3</th>
      <td>England</td>
      <td>5</td>
      <td>11</td>
      <td>18</td>
      <td>50.0%</td>
      <td>17.2%</td>
      <td>40</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>22</td>
      <td>88.1%</td>
      <td>43</td>
      <td>45</td>
      <td>6</td>
      <td>5</td>
      <td>0</td>
      <td>11</td>
      <td>11</td>
      <td>16</td>
    </tr>
    <tr>
      <th>4</th>
      <td>France</td>
      <td>3</td>
      <td>22</td>
      <td>24</td>
      <td>37.9%</td>
      <td>6.5%</td>
      <td>65</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>6</td>
      <td>54.6%</td>
      <td>36</td>
      <td>51</td>
      <td>5</td>
      <td>6</td>
      <td>0</td>
      <td>11</td>
      <td>11</td>
      <td>19</td>
    </tr>
  </tbody>
</table>
<p>5 rows × 35 columns</p>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12.Goals</span><br></pre></td></tr></table></figure>




<pre><code>0      4
1      4
2      4
3      5
4      3
5     10
6      5
7      6
8      2
9      2
10     6
11     1
12     5
13    12
14     5
15     2
Name: Goals, dtype: int64</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12.shape[<span class="number">0</span>]</span><br></pre></td></tr></table></figure>




<pre><code>16</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12.shape[<span class="number">1</span>]</span><br></pre></td></tr></table></figure>




<pre><code>35</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12.info()</span><br></pre></td></tr></table></figure>

<pre><code>&lt;class &apos;pandas.core.frame.DataFrame&apos;&gt;
RangeIndex: 16 entries, 0 to 15
Data columns (total 35 columns):
 #   Column                      Non-Null Count  Dtype  
---  ------                      --------------  -----  
 0   Team                        16 non-null     object 
 1   Goals                       16 non-null     int64  
 2   Shots on target             16 non-null     int64  
 3   Shots off target            16 non-null     int64  
 4   Shooting Accuracy           16 non-null     object 
 5   % Goals-to-shots            16 non-null     object 
 6   Total shots (inc. Blocked)  16 non-null     int64  
 7   Hit Woodwork                16 non-null     int64  
 8   Penalty goals               16 non-null     int64  
 9   Penalties not scored        16 non-null     int64  
 10  Headed goals                16 non-null     int64  
 11  Passes                      16 non-null     int64  
 12  Passes completed            16 non-null     int64  
 13  Passing Accuracy            16 non-null     object 
 14  Touches                     16 non-null     int64  
 15  Crosses                     16 non-null     int64  
 16  Dribbles                    16 non-null     int64  
 17  Corners Taken               16 non-null     int64  
 18  Tackles                     16 non-null     int64  
 19  Clearances                  16 non-null     int64  
 20  Interceptions               16 non-null     int64  
 21  Clearances off line         15 non-null     float64
 22  Clean Sheets                16 non-null     int64  
 23  Blocks                      16 non-null     int64  
 24  Goals conceded              16 non-null     int64  
 25  Saves made                  16 non-null     int64  
 26  Saves-to-shots ratio        16 non-null     object 
 27  Fouls Won                   16 non-null     int64  
 28  Fouls Conceded              16 non-null     int64  
 29  Offsides                    16 non-null     int64  
 30  Yellow Cards                16 non-null     int64  
 31  Red Cards                   16 non-null     int64  
 32  Subs on                     16 non-null     int64  
 33  Subs off                    16 non-null     int64  
 34  Players Used                16 non-null     int64  
dtypes: float64(1), int64(29), object(5)
memory usage: 4.5+ KB</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">disclipline = euro12[[<span class="string">'Team'</span>,<span class="string">'Yellow Cards'</span>,<span class="string">'Red Cards'</span>]]</span><br><span class="line">disclipline</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Yellow Cards</th>
      <th>Red Cards</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Croatia</td>
      <td>9</td>
      <td>0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Czech Republic</td>
      <td>7</td>
      <td>0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Denmark</td>
      <td>4</td>
      <td>0</td>
    </tr>
    <tr>
      <th>3</th>
      <td>England</td>
      <td>5</td>
      <td>0</td>
    </tr>
    <tr>
      <th>4</th>
      <td>France</td>
      <td>6</td>
      <td>0</td>
    </tr>
    <tr>
      <th>5</th>
      <td>Germany</td>
      <td>4</td>
      <td>0</td>
    </tr>
    <tr>
      <th>6</th>
      <td>Greece</td>
      <td>9</td>
      <td>1</td>
    </tr>
    <tr>
      <th>7</th>
      <td>Italy</td>
      <td>16</td>
      <td>0</td>
    </tr>
    <tr>
      <th>8</th>
      <td>Netherlands</td>
      <td>5</td>
      <td>0</td>
    </tr>
    <tr>
      <th>9</th>
      <td>Poland</td>
      <td>7</td>
      <td>1</td>
    </tr>
    <tr>
      <th>10</th>
      <td>Portugal</td>
      <td>12</td>
      <td>0</td>
    </tr>
    <tr>
      <th>11</th>
      <td>Republic of Ireland</td>
      <td>6</td>
      <td>1</td>
    </tr>
    <tr>
      <th>12</th>
      <td>Russia</td>
      <td>6</td>
      <td>0</td>
    </tr>
    <tr>
      <th>13</th>
      <td>Spain</td>
      <td>11</td>
      <td>0</td>
    </tr>
    <tr>
      <th>14</th>
      <td>Sweden</td>
      <td>7</td>
      <td>0</td>
    </tr>
    <tr>
      <th>15</th>
      <td>Ukraine</td>
      <td>5</td>
      <td>0</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">disclipline.sort_values([<span class="string">'Red Cards'</span>,<span class="string">'Yellow Cards'</span>],ascending=<span class="literal">False</span>)</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Yellow Cards</th>
      <th>Red Cards</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>6</th>
      <td>Greece</td>
      <td>9</td>
      <td>1</td>
    </tr>
    <tr>
      <th>9</th>
      <td>Poland</td>
      <td>7</td>
      <td>1</td>
    </tr>
    <tr>
      <th>11</th>
      <td>Republic of Ireland</td>
      <td>6</td>
      <td>1</td>
    </tr>
    <tr>
      <th>7</th>
      <td>Italy</td>
      <td>16</td>
      <td>0</td>
    </tr>
    <tr>
      <th>10</th>
      <td>Portugal</td>
      <td>12</td>
      <td>0</td>
    </tr>
    <tr>
      <th>13</th>
      <td>Spain</td>
      <td>11</td>
      <td>0</td>
    </tr>
    <tr>
      <th>0</th>
      <td>Croatia</td>
      <td>9</td>
      <td>0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Czech Republic</td>
      <td>7</td>
      <td>0</td>
    </tr>
    <tr>
      <th>14</th>
      <td>Sweden</td>
      <td>7</td>
      <td>0</td>
    </tr>
    <tr>
      <th>4</th>
      <td>France</td>
      <td>6</td>
      <td>0</td>
    </tr>
    <tr>
      <th>12</th>
      <td>Russia</td>
      <td>6</td>
      <td>0</td>
    </tr>
    <tr>
      <th>3</th>
      <td>England</td>
      <td>5</td>
      <td>0</td>
    </tr>
    <tr>
      <th>8</th>
      <td>Netherlands</td>
      <td>5</td>
      <td>0</td>
    </tr>
    <tr>
      <th>15</th>
      <td>Ukraine</td>
      <td>5</td>
      <td>0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Denmark</td>
      <td>4</td>
      <td>0</td>
    </tr>
    <tr>
      <th>5</th>
      <td>Germany</td>
      <td>4</td>
      <td>0</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">round(disclipline[<span class="string">'Yellow Cards'</span>].mean())</span><br></pre></td></tr></table></figure>




<pre><code>7</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12[euro12.Goals &gt; <span class="number">6</span>]</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Goals</th>
      <th>Shots on target</th>
      <th>Shots off target</th>
      <th>Shooting Accuracy</th>
      <th>% Goals-to-shots</th>
      <th>Total shots (inc. Blocked)</th>
      <th>Hit Woodwork</th>
      <th>Penalty goals</th>
      <th>Penalties not scored</th>
      <th>...</th>
      <th>Saves made</th>
      <th>Saves-to-shots ratio</th>
      <th>Fouls Won</th>
      <th>Fouls Conceded</th>
      <th>Offsides</th>
      <th>Yellow Cards</th>
      <th>Red Cards</th>
      <th>Subs on</th>
      <th>Subs off</th>
      <th>Players Used</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>5</th>
      <td>Germany</td>
      <td>10</td>
      <td>32</td>
      <td>32</td>
      <td>47.8%</td>
      <td>15.6%</td>
      <td>80</td>
      <td>2</td>
      <td>1</td>
      <td>0</td>
      <td>...</td>
      <td>10</td>
      <td>62.6%</td>
      <td>63</td>
      <td>49</td>
      <td>12</td>
      <td>4</td>
      <td>0</td>
      <td>15</td>
      <td>15</td>
      <td>17</td>
    </tr>
    <tr>
      <th>13</th>
      <td>Spain</td>
      <td>12</td>
      <td>42</td>
      <td>33</td>
      <td>55.9%</td>
      <td>16.0%</td>
      <td>100</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>...</td>
      <td>15</td>
      <td>93.8%</td>
      <td>102</td>
      <td>83</td>
      <td>19</td>
      <td>11</td>
      <td>0</td>
      <td>17</td>
      <td>17</td>
      <td>18</td>
    </tr>
  </tbody>
</table>
<p>2 rows × 35 columns</p>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12[euro12.Team.str.startswith(<span class="string">'G'</span>)]</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Goals</th>
      <th>Shots on target</th>
      <th>Shots off target</th>
      <th>Shooting Accuracy</th>
      <th>% Goals-to-shots</th>
      <th>Total shots (inc. Blocked)</th>
      <th>Hit Woodwork</th>
      <th>Penalty goals</th>
      <th>Penalties not scored</th>
      <th>...</th>
      <th>Saves made</th>
      <th>Saves-to-shots ratio</th>
      <th>Fouls Won</th>
      <th>Fouls Conceded</th>
      <th>Offsides</th>
      <th>Yellow Cards</th>
      <th>Red Cards</th>
      <th>Subs on</th>
      <th>Subs off</th>
      <th>Players Used</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>5</th>
      <td>Germany</td>
      <td>10</td>
      <td>32</td>
      <td>32</td>
      <td>47.8%</td>
      <td>15.6%</td>
      <td>80</td>
      <td>2</td>
      <td>1</td>
      <td>0</td>
      <td>...</td>
      <td>10</td>
      <td>62.6%</td>
      <td>63</td>
      <td>49</td>
      <td>12</td>
      <td>4</td>
      <td>0</td>
      <td>15</td>
      <td>15</td>
      <td>17</td>
    </tr>
    <tr>
      <th>6</th>
      <td>Greece</td>
      <td>5</td>
      <td>8</td>
      <td>18</td>
      <td>30.7%</td>
      <td>19.2%</td>
      <td>32</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>...</td>
      <td>13</td>
      <td>65.1%</td>
      <td>67</td>
      <td>48</td>
      <td>12</td>
      <td>9</td>
      <td>1</td>
      <td>12</td>
      <td>12</td>
      <td>20</td>
    </tr>
  </tbody>
</table>
<p>2 rows × 35 columns</p>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12.iloc[:,:<span class="number">7</span>]</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Goals</th>
      <th>Shots on target</th>
      <th>Shots off target</th>
      <th>Shooting Accuracy</th>
      <th>% Goals-to-shots</th>
      <th>Total shots (inc. Blocked)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Croatia</td>
      <td>4</td>
      <td>13</td>
      <td>12</td>
      <td>51.9%</td>
      <td>16.0%</td>
      <td>32</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Czech Republic</td>
      <td>4</td>
      <td>13</td>
      <td>18</td>
      <td>41.9%</td>
      <td>12.9%</td>
      <td>39</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Denmark</td>
      <td>4</td>
      <td>10</td>
      <td>10</td>
      <td>50.0%</td>
      <td>20.0%</td>
      <td>27</td>
    </tr>
    <tr>
      <th>3</th>
      <td>England</td>
      <td>5</td>
      <td>11</td>
      <td>18</td>
      <td>50.0%</td>
      <td>17.2%</td>
      <td>40</td>
    </tr>
    <tr>
      <th>4</th>
      <td>France</td>
      <td>3</td>
      <td>22</td>
      <td>24</td>
      <td>37.9%</td>
      <td>6.5%</td>
      <td>65</td>
    </tr>
    <tr>
      <th>5</th>
      <td>Germany</td>
      <td>10</td>
      <td>32</td>
      <td>32</td>
      <td>47.8%</td>
      <td>15.6%</td>
      <td>80</td>
    </tr>
    <tr>
      <th>6</th>
      <td>Greece</td>
      <td>5</td>
      <td>8</td>
      <td>18</td>
      <td>30.7%</td>
      <td>19.2%</td>
      <td>32</td>
    </tr>
    <tr>
      <th>7</th>
      <td>Italy</td>
      <td>6</td>
      <td>34</td>
      <td>45</td>
      <td>43.0%</td>
      <td>7.5%</td>
      <td>110</td>
    </tr>
    <tr>
      <th>8</th>
      <td>Netherlands</td>
      <td>2</td>
      <td>12</td>
      <td>36</td>
      <td>25.0%</td>
      <td>4.1%</td>
      <td>60</td>
    </tr>
    <tr>
      <th>9</th>
      <td>Poland</td>
      <td>2</td>
      <td>15</td>
      <td>23</td>
      <td>39.4%</td>
      <td>5.2%</td>
      <td>48</td>
    </tr>
    <tr>
      <th>10</th>
      <td>Portugal</td>
      <td>6</td>
      <td>22</td>
      <td>42</td>
      <td>34.3%</td>
      <td>9.3%</td>
      <td>82</td>
    </tr>
    <tr>
      <th>11</th>
      <td>Republic of Ireland</td>
      <td>1</td>
      <td>7</td>
      <td>12</td>
      <td>36.8%</td>
      <td>5.2%</td>
      <td>28</td>
    </tr>
    <tr>
      <th>12</th>
      <td>Russia</td>
      <td>5</td>
      <td>9</td>
      <td>31</td>
      <td>22.5%</td>
      <td>12.5%</td>
      <td>59</td>
    </tr>
    <tr>
      <th>13</th>
      <td>Spain</td>
      <td>12</td>
      <td>42</td>
      <td>33</td>
      <td>55.9%</td>
      <td>16.0%</td>
      <td>100</td>
    </tr>
    <tr>
      <th>14</th>
      <td>Sweden</td>
      <td>5</td>
      <td>17</td>
      <td>19</td>
      <td>47.2%</td>
      <td>13.8%</td>
      <td>39</td>
    </tr>
    <tr>
      <th>15</th>
      <td>Ukraine</td>
      <td>2</td>
      <td>7</td>
      <td>26</td>
      <td>21.2%</td>
      <td>6.0%</td>
      <td>38</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">euro12.iloc[:,:<span class="number">-3</span>]</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Goals</th>
      <th>Shots on target</th>
      <th>Shots off target</th>
      <th>Shooting Accuracy</th>
      <th>% Goals-to-shots</th>
      <th>Total shots (inc. Blocked)</th>
      <th>Hit Woodwork</th>
      <th>Penalty goals</th>
      <th>Penalties not scored</th>
      <th>...</th>
      <th>Clean Sheets</th>
      <th>Blocks</th>
      <th>Goals conceded</th>
      <th>Saves made</th>
      <th>Saves-to-shots ratio</th>
      <th>Fouls Won</th>
      <th>Fouls Conceded</th>
      <th>Offsides</th>
      <th>Yellow Cards</th>
      <th>Red Cards</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Croatia</td>
      <td>4</td>
      <td>13</td>
      <td>12</td>
      <td>51.9%</td>
      <td>16.0%</td>
      <td>32</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>0</td>
      <td>10</td>
      <td>3</td>
      <td>13</td>
      <td>81.3%</td>
      <td>41</td>
      <td>62</td>
      <td>2</td>
      <td>9</td>
      <td>0</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Czech Republic</td>
      <td>4</td>
      <td>13</td>
      <td>18</td>
      <td>41.9%</td>
      <td>12.9%</td>
      <td>39</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>1</td>
      <td>10</td>
      <td>6</td>
      <td>9</td>
      <td>60.1%</td>
      <td>53</td>
      <td>73</td>
      <td>8</td>
      <td>7</td>
      <td>0</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Denmark</td>
      <td>4</td>
      <td>10</td>
      <td>10</td>
      <td>50.0%</td>
      <td>20.0%</td>
      <td>27</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>1</td>
      <td>10</td>
      <td>5</td>
      <td>10</td>
      <td>66.7%</td>
      <td>25</td>
      <td>38</td>
      <td>8</td>
      <td>4</td>
      <td>0</td>
    </tr>
    <tr>
      <th>3</th>
      <td>England</td>
      <td>5</td>
      <td>11</td>
      <td>18</td>
      <td>50.0%</td>
      <td>17.2%</td>
      <td>40</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>2</td>
      <td>29</td>
      <td>3</td>
      <td>22</td>
      <td>88.1%</td>
      <td>43</td>
      <td>45</td>
      <td>6</td>
      <td>5</td>
      <td>0</td>
    </tr>
    <tr>
      <th>4</th>
      <td>France</td>
      <td>3</td>
      <td>22</td>
      <td>24</td>
      <td>37.9%</td>
      <td>6.5%</td>
      <td>65</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>1</td>
      <td>7</td>
      <td>5</td>
      <td>6</td>
      <td>54.6%</td>
      <td>36</td>
      <td>51</td>
      <td>5</td>
      <td>6</td>
      <td>0</td>
    </tr>
    <tr>
      <th>5</th>
      <td>Germany</td>
      <td>10</td>
      <td>32</td>
      <td>32</td>
      <td>47.8%</td>
      <td>15.6%</td>
      <td>80</td>
      <td>2</td>
      <td>1</td>
      <td>0</td>
      <td>...</td>
      <td>1</td>
      <td>11</td>
      <td>6</td>
      <td>10</td>
      <td>62.6%</td>
      <td>63</td>
      <td>49</td>
      <td>12</td>
      <td>4</td>
      <td>0</td>
    </tr>
    <tr>
      <th>6</th>
      <td>Greece</td>
      <td>5</td>
      <td>8</td>
      <td>18</td>
      <td>30.7%</td>
      <td>19.2%</td>
      <td>32</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>...</td>
      <td>1</td>
      <td>23</td>
      <td>7</td>
      <td>13</td>
      <td>65.1%</td>
      <td>67</td>
      <td>48</td>
      <td>12</td>
      <td>9</td>
      <td>1</td>
    </tr>
    <tr>
      <th>7</th>
      <td>Italy</td>
      <td>6</td>
      <td>34</td>
      <td>45</td>
      <td>43.0%</td>
      <td>7.5%</td>
      <td>110</td>
      <td>2</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>2</td>
      <td>18</td>
      <td>7</td>
      <td>20</td>
      <td>74.1%</td>
      <td>101</td>
      <td>89</td>
      <td>16</td>
      <td>16</td>
      <td>0</td>
    </tr>
    <tr>
      <th>8</th>
      <td>Netherlands</td>
      <td>2</td>
      <td>12</td>
      <td>36</td>
      <td>25.0%</td>
      <td>4.1%</td>
      <td>60</td>
      <td>2</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>0</td>
      <td>9</td>
      <td>5</td>
      <td>12</td>
      <td>70.6%</td>
      <td>35</td>
      <td>30</td>
      <td>3</td>
      <td>5</td>
      <td>0</td>
    </tr>
    <tr>
      <th>9</th>
      <td>Poland</td>
      <td>2</td>
      <td>15</td>
      <td>23</td>
      <td>39.4%</td>
      <td>5.2%</td>
      <td>48</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>0</td>
      <td>8</td>
      <td>3</td>
      <td>6</td>
      <td>66.7%</td>
      <td>48</td>
      <td>56</td>
      <td>3</td>
      <td>7</td>
      <td>1</td>
    </tr>
    <tr>
      <th>10</th>
      <td>Portugal</td>
      <td>6</td>
      <td>22</td>
      <td>42</td>
      <td>34.3%</td>
      <td>9.3%</td>
      <td>82</td>
      <td>6</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>2</td>
      <td>11</td>
      <td>4</td>
      <td>10</td>
      <td>71.5%</td>
      <td>73</td>
      <td>90</td>
      <td>10</td>
      <td>12</td>
      <td>0</td>
    </tr>
    <tr>
      <th>11</th>
      <td>Republic of Ireland</td>
      <td>1</td>
      <td>7</td>
      <td>12</td>
      <td>36.8%</td>
      <td>5.2%</td>
      <td>28</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>0</td>
      <td>23</td>
      <td>9</td>
      <td>17</td>
      <td>65.4%</td>
      <td>43</td>
      <td>51</td>
      <td>11</td>
      <td>6</td>
      <td>1</td>
    </tr>
    <tr>
      <th>12</th>
      <td>Russia</td>
      <td>5</td>
      <td>9</td>
      <td>31</td>
      <td>22.5%</td>
      <td>12.5%</td>
      <td>59</td>
      <td>2</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>0</td>
      <td>8</td>
      <td>3</td>
      <td>10</td>
      <td>77.0%</td>
      <td>34</td>
      <td>43</td>
      <td>4</td>
      <td>6</td>
      <td>0</td>
    </tr>
    <tr>
      <th>13</th>
      <td>Spain</td>
      <td>12</td>
      <td>42</td>
      <td>33</td>
      <td>55.9%</td>
      <td>16.0%</td>
      <td>100</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>...</td>
      <td>5</td>
      <td>8</td>
      <td>1</td>
      <td>15</td>
      <td>93.8%</td>
      <td>102</td>
      <td>83</td>
      <td>19</td>
      <td>11</td>
      <td>0</td>
    </tr>
    <tr>
      <th>14</th>
      <td>Sweden</td>
      <td>5</td>
      <td>17</td>
      <td>19</td>
      <td>47.2%</td>
      <td>13.8%</td>
      <td>39</td>
      <td>3</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>1</td>
      <td>12</td>
      <td>5</td>
      <td>8</td>
      <td>61.6%</td>
      <td>35</td>
      <td>51</td>
      <td>7</td>
      <td>7</td>
      <td>0</td>
    </tr>
    <tr>
      <th>15</th>
      <td>Ukraine</td>
      <td>2</td>
      <td>7</td>
      <td>26</td>
      <td>21.2%</td>
      <td>6.0%</td>
      <td>38</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>...</td>
      <td>0</td>
      <td>4</td>
      <td>4</td>
      <td>13</td>
      <td>76.5%</td>
      <td>48</td>
      <td>31</td>
      <td>4</td>
      <td>5</td>
      <td>0</td>
    </tr>
  </tbody>
</table>
<p>16 rows × 32 columns</p>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#找到英格兰(England)、意大利(Italy)和俄罗斯(Russia)的射正率(Shooting Accuracy)</span></span><br><span class="line">euro12.loc[euro12.Team.isin([<span class="string">'England'</span>,<span class="string">'Italy'</span>,<span class="string">'Russia'</span>]),[<span class="string">'Team'</span>,<span class="string">'Shooting Accuracy'</span>]]</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Team</th>
      <th>Shooting Accuracy</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>3</th>
      <td>England</td>
      <td>50.0%</td>
    </tr>
    <tr>
      <th>7</th>
      <td>Italy</td>
      <td>43.0%</td>
    </tr>
    <tr>
      <th>12</th>
      <td>Russia</td>
      <td>22.5%</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#酒类消费数据（练习三）</span></span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line">drink = pd.read_csv(<span class="string">'drinks.csv'</span>)</span><br><span class="line">drink.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>country</th>
      <th>beer_servings</th>
      <th>spirit_servings</th>
      <th>wine_servings</th>
      <th>total_litres_of_pure_alcohol</th>
      <th>continent</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Afghanistan</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0.0</td>
      <td>AS</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Albania</td>
      <td>89</td>
      <td>132</td>
      <td>54</td>
      <td>4.9</td>
      <td>EU</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Algeria</td>
      <td>25</td>
      <td>0</td>
      <td>14</td>
      <td>0.7</td>
      <td>AF</td>
    </tr>
    <tr>
      <th>3</th>
      <td>Andorra</td>
      <td>245</td>
      <td>138</td>
      <td>312</td>
      <td>12.4</td>
      <td>EU</td>
    </tr>
    <tr>
      <th>4</th>
      <td>Angola</td>
      <td>217</td>
      <td>57</td>
      <td>45</td>
      <td>5.9</td>
      <td>AF</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">beer  = drink.groupby(<span class="string">'continent'</span>).beer_servings.mean()</span><br><span class="line">beer.sort_values(ascending=<span class="literal">False</span>)</span><br></pre></td></tr></table></figure>




<pre><code>continent
EU    193.777778
SA    175.083333
OC     89.687500
AF     61.471698
AS     37.045455
Name: beer_servings, dtype: float64</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">drink.groupby(<span class="string">'continent'</span>).wine_servings.describe()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>count</th>
      <th>mean</th>
      <th>std</th>
      <th>min</th>
      <th>25%</th>
      <th>50%</th>
      <th>75%</th>
      <th>max</th>
    </tr>
    <tr>
      <th>continent</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>AF</th>
      <td>53.0</td>
      <td>16.264151</td>
      <td>38.846419</td>
      <td>0.0</td>
      <td>1.0</td>
      <td>2.0</td>
      <td>13.00</td>
      <td>233.0</td>
    </tr>
    <tr>
      <th>AS</th>
      <td>44.0</td>
      <td>9.068182</td>
      <td>21.667034</td>
      <td>0.0</td>
      <td>0.0</td>
      <td>1.0</td>
      <td>8.00</td>
      <td>123.0</td>
    </tr>
    <tr>
      <th>EU</th>
      <td>45.0</td>
      <td>142.222222</td>
      <td>97.421738</td>
      <td>0.0</td>
      <td>59.0</td>
      <td>128.0</td>
      <td>195.00</td>
      <td>370.0</td>
    </tr>
    <tr>
      <th>OC</th>
      <td>16.0</td>
      <td>35.625000</td>
      <td>64.555790</td>
      <td>0.0</td>
      <td>1.0</td>
      <td>8.5</td>
      <td>23.25</td>
      <td>212.0</td>
    </tr>
    <tr>
      <th>SA</th>
      <td>12.0</td>
      <td>62.416667</td>
      <td>88.620189</td>
      <td>1.0</td>
      <td>3.0</td>
      <td>12.0</td>
      <td>98.50</td>
      <td>221.0</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">drink.groupby(<span class="string">'continent'</span>).mean()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>beer_servings</th>
      <th>spirit_servings</th>
      <th>wine_servings</th>
      <th>total_litres_of_pure_alcohol</th>
    </tr>
    <tr>
      <th>continent</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>AF</th>
      <td>61.471698</td>
      <td>16.339623</td>
      <td>16.264151</td>
      <td>3.007547</td>
    </tr>
    <tr>
      <th>AS</th>
      <td>37.045455</td>
      <td>60.840909</td>
      <td>9.068182</td>
      <td>2.170455</td>
    </tr>
    <tr>
      <th>EU</th>
      <td>193.777778</td>
      <td>132.555556</td>
      <td>142.222222</td>
      <td>8.617778</td>
    </tr>
    <tr>
      <th>OC</th>
      <td>89.687500</td>
      <td>58.437500</td>
      <td>35.625000</td>
      <td>3.381250</td>
    </tr>
    <tr>
      <th>SA</th>
      <td>175.083333</td>
      <td>114.750000</td>
      <td>62.416667</td>
      <td>6.308333</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">drink.groupby(<span class="string">'continent'</span>).median()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>beer_servings</th>
      <th>spirit_servings</th>
      <th>wine_servings</th>
      <th>total_litres_of_pure_alcohol</th>
    </tr>
    <tr>
      <th>continent</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>AF</th>
      <td>32.0</td>
      <td>3.0</td>
      <td>2.0</td>
      <td>2.30</td>
    </tr>
    <tr>
      <th>AS</th>
      <td>17.5</td>
      <td>16.0</td>
      <td>1.0</td>
      <td>1.20</td>
    </tr>
    <tr>
      <th>EU</th>
      <td>219.0</td>
      <td>122.0</td>
      <td>128.0</td>
      <td>10.00</td>
    </tr>
    <tr>
      <th>OC</th>
      <td>52.5</td>
      <td>37.0</td>
      <td>8.5</td>
      <td>1.75</td>
    </tr>
    <tr>
      <th>SA</th>
      <td>162.5</td>
      <td>108.5</td>
      <td>12.0</td>
      <td>6.85</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">drink.groupby(<span class="string">'continent'</span>).spirit_servings.agg([<span class="string">'mean'</span>,<span class="string">'min'</span>,<span class="string">'max'</span>])</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>mean</th>
      <th>min</th>
      <th>max</th>
    </tr>
    <tr>
      <th>continent</th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>AF</th>
      <td>16.339623</td>
      <td>0</td>
      <td>152</td>
    </tr>
    <tr>
      <th>AS</th>
      <td>60.840909</td>
      <td>0</td>
      <td>326</td>
    </tr>
    <tr>
      <th>EU</th>
      <td>132.555556</td>
      <td>0</td>
      <td>373</td>
    </tr>
    <tr>
      <th>OC</th>
      <td>58.437500</td>
      <td>0</td>
      <td>254</td>
    </tr>
    <tr>
      <th>SA</th>
      <td>114.750000</td>
      <td>25</td>
      <td>302</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#2014美国犯罪数据（练习四）</span></span><br><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"></span><br><span class="line">crime = pd.read_csv(<span class="string">'US_Crime_Rates_1960_2014.csv'</span>)</span><br><span class="line">crime.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Year</th>
      <th>Population</th>
      <th>Total</th>
      <th>Violent</th>
      <th>Property</th>
      <th>Murder</th>
      <th>Forcible_Rape</th>
      <th>Robbery</th>
      <th>Aggravated_assault</th>
      <th>Burglary</th>
      <th>Larceny_Theft</th>
      <th>Vehicle_Theft</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1960</td>
      <td>179323175</td>
      <td>3384200</td>
      <td>288460</td>
      <td>3095700</td>
      <td>9110</td>
      <td>17190</td>
      <td>107840</td>
      <td>154320</td>
      <td>912100</td>
      <td>1855400</td>
      <td>328200</td>
    </tr>
    <tr>
      <th>1</th>
      <td>1961</td>
      <td>182992000</td>
      <td>3488000</td>
      <td>289390</td>
      <td>3198600</td>
      <td>8740</td>
      <td>17220</td>
      <td>106670</td>
      <td>156760</td>
      <td>949600</td>
      <td>1913000</td>
      <td>336000</td>
    </tr>
    <tr>
      <th>2</th>
      <td>1962</td>
      <td>185771000</td>
      <td>3752200</td>
      <td>301510</td>
      <td>3450700</td>
      <td>8530</td>
      <td>17550</td>
      <td>110860</td>
      <td>164570</td>
      <td>994300</td>
      <td>2089600</td>
      <td>366800</td>
    </tr>
    <tr>
      <th>3</th>
      <td>1963</td>
      <td>188483000</td>
      <td>4109500</td>
      <td>316970</td>
      <td>3792500</td>
      <td>8640</td>
      <td>17650</td>
      <td>116470</td>
      <td>174210</td>
      <td>1086400</td>
      <td>2297800</td>
      <td>408300</td>
    </tr>
    <tr>
      <th>4</th>
      <td>1964</td>
      <td>191141000</td>
      <td>4564600</td>
      <td>364220</td>
      <td>4200400</td>
      <td>9360</td>
      <td>21420</td>
      <td>130390</td>
      <td>203050</td>
      <td>1213200</td>
      <td>2514400</td>
      <td>472800</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">crime.info()</span><br></pre></td></tr></table></figure>

<pre><code>&lt;class &apos;pandas.core.frame.DataFrame&apos;&gt;
RangeIndex: 55 entries, 0 to 54
Data columns (total 12 columns):
 #   Column              Non-Null Count  Dtype
---  ------              --------------  -----
 0   Year                55 non-null     int64
 1   Population          55 non-null     int64
 2   Total               55 non-null     int64
 3   Violent             55 non-null     int64
 4   Property            55 non-null     int64
 5   Murder              55 non-null     int64
 6   Forcible_Rape       55 non-null     int64
 7   Robbery             55 non-null     int64
 8   Aggravated_assault  55 non-null     int64
 9   Burglary            55 non-null     int64
 10  Larceny_Theft       55 non-null     int64
 11  Vehicle_Theft       55 non-null     int64
dtypes: int64(12)
memory usage: 5.3 KB</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">crime.Year = pd.to_datetime(crime.Year,format=<span class="string">'%Y'</span>)</span><br><span class="line">crime.info()</span><br><span class="line">crime.head()</span><br></pre></td></tr></table></figure>

<pre><code>&lt;class &apos;pandas.core.frame.DataFrame&apos;&gt;
RangeIndex: 55 entries, 0 to 54
Data columns (total 12 columns):
 #   Column              Non-Null Count  Dtype         
---  ------              --------------  -----         
 0   Year                55 non-null     datetime64[ns]
 1   Population          55 non-null     int64         
 2   Total               55 non-null     int64         
 3   Violent             55 non-null     int64         
 4   Property            55 non-null     int64         
 5   Murder              55 non-null     int64         
 6   Forcible_Rape       55 non-null     int64         
 7   Robbery             55 non-null     int64         
 8   Aggravated_assault  55 non-null     int64         
 9   Burglary            55 non-null     int64         
 10  Larceny_Theft       55 non-null     int64         
 11  Vehicle_Theft       55 non-null     int64         
dtypes: datetime64[ns](1), int64(11)
memory usage: 5.3 KB</code></pre><div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Year</th>
      <th>Population</th>
      <th>Total</th>
      <th>Violent</th>
      <th>Property</th>
      <th>Murder</th>
      <th>Forcible_Rape</th>
      <th>Robbery</th>
      <th>Aggravated_assault</th>
      <th>Burglary</th>
      <th>Larceny_Theft</th>
      <th>Vehicle_Theft</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1960-01-01</td>
      <td>179323175</td>
      <td>3384200</td>
      <td>288460</td>
      <td>3095700</td>
      <td>9110</td>
      <td>17190</td>
      <td>107840</td>
      <td>154320</td>
      <td>912100</td>
      <td>1855400</td>
      <td>328200</td>
    </tr>
    <tr>
      <th>1</th>
      <td>1961-01-01</td>
      <td>182992000</td>
      <td>3488000</td>
      <td>289390</td>
      <td>3198600</td>
      <td>8740</td>
      <td>17220</td>
      <td>106670</td>
      <td>156760</td>
      <td>949600</td>
      <td>1913000</td>
      <td>336000</td>
    </tr>
    <tr>
      <th>2</th>
      <td>1962-01-01</td>
      <td>185771000</td>
      <td>3752200</td>
      <td>301510</td>
      <td>3450700</td>
      <td>8530</td>
      <td>17550</td>
      <td>110860</td>
      <td>164570</td>
      <td>994300</td>
      <td>2089600</td>
      <td>366800</td>
    </tr>
    <tr>
      <th>3</th>
      <td>1963-01-01</td>
      <td>188483000</td>
      <td>4109500</td>
      <td>316970</td>
      <td>3792500</td>
      <td>8640</td>
      <td>17650</td>
      <td>116470</td>
      <td>174210</td>
      <td>1086400</td>
      <td>2297800</td>
      <td>408300</td>
    </tr>
    <tr>
      <th>4</th>
      <td>1964-01-01</td>
      <td>191141000</td>
      <td>4564600</td>
      <td>364220</td>
      <td>4200400</td>
      <td>9360</td>
      <td>21420</td>
      <td>130390</td>
      <td>203050</td>
      <td>1213200</td>
      <td>2514400</td>
      <td>472800</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">crime = crime.set_index(<span class="string">'Year'</span>,drop=<span class="literal">True</span>)</span><br><span class="line">crime.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Population</th>
      <th>Total</th>
      <th>Violent</th>
      <th>Property</th>
      <th>Murder</th>
      <th>Forcible_Rape</th>
      <th>Robbery</th>
      <th>Aggravated_assault</th>
      <th>Burglary</th>
      <th>Larceny_Theft</th>
      <th>Vehicle_Theft</th>
    </tr>
    <tr>
      <th>Year</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1960-01-01</th>
      <td>179323175</td>
      <td>3384200</td>
      <td>288460</td>
      <td>3095700</td>
      <td>9110</td>
      <td>17190</td>
      <td>107840</td>
      <td>154320</td>
      <td>912100</td>
      <td>1855400</td>
      <td>328200</td>
    </tr>
    <tr>
      <th>1961-01-01</th>
      <td>182992000</td>
      <td>3488000</td>
      <td>289390</td>
      <td>3198600</td>
      <td>8740</td>
      <td>17220</td>
      <td>106670</td>
      <td>156760</td>
      <td>949600</td>
      <td>1913000</td>
      <td>336000</td>
    </tr>
    <tr>
      <th>1962-01-01</th>
      <td>185771000</td>
      <td>3752200</td>
      <td>301510</td>
      <td>3450700</td>
      <td>8530</td>
      <td>17550</td>
      <td>110860</td>
      <td>164570</td>
      <td>994300</td>
      <td>2089600</td>
      <td>366800</td>
    </tr>
    <tr>
      <th>1963-01-01</th>
      <td>188483000</td>
      <td>4109500</td>
      <td>316970</td>
      <td>3792500</td>
      <td>8640</td>
      <td>17650</td>
      <td>116470</td>
      <td>174210</td>
      <td>1086400</td>
      <td>2297800</td>
      <td>408300</td>
    </tr>
    <tr>
      <th>1964-01-01</th>
      <td>191141000</td>
      <td>4564600</td>
      <td>364220</td>
      <td>4200400</td>
      <td>9360</td>
      <td>21420</td>
      <td>130390</td>
      <td>203050</td>
      <td>1213200</td>
      <td>2514400</td>
      <td>472800</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">del</span> crime[<span class="string">'Total'</span>]</span><br><span class="line">crime.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Population</th>
      <th>Violent</th>
      <th>Property</th>
      <th>Murder</th>
      <th>Forcible_Rape</th>
      <th>Robbery</th>
      <th>Aggravated_assault</th>
      <th>Burglary</th>
      <th>Larceny_Theft</th>
      <th>Vehicle_Theft</th>
    </tr>
    <tr>
      <th>Year</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1960-01-01</th>
      <td>179323175</td>
      <td>288460</td>
      <td>3095700</td>
      <td>9110</td>
      <td>17190</td>
      <td>107840</td>
      <td>154320</td>
      <td>912100</td>
      <td>1855400</td>
      <td>328200</td>
    </tr>
    <tr>
      <th>1961-01-01</th>
      <td>182992000</td>
      <td>289390</td>
      <td>3198600</td>
      <td>8740</td>
      <td>17220</td>
      <td>106670</td>
      <td>156760</td>
      <td>949600</td>
      <td>1913000</td>
      <td>336000</td>
    </tr>
    <tr>
      <th>1962-01-01</th>
      <td>185771000</td>
      <td>301510</td>
      <td>3450700</td>
      <td>8530</td>
      <td>17550</td>
      <td>110860</td>
      <td>164570</td>
      <td>994300</td>
      <td>2089600</td>
      <td>366800</td>
    </tr>
    <tr>
      <th>1963-01-01</th>
      <td>188483000</td>
      <td>316970</td>
      <td>3792500</td>
      <td>8640</td>
      <td>17650</td>
      <td>116470</td>
      <td>174210</td>
      <td>1086400</td>
      <td>2297800</td>
      <td>408300</td>
    </tr>
    <tr>
      <th>1964-01-01</th>
      <td>191141000</td>
      <td>364220</td>
      <td>4200400</td>
      <td>9360</td>
      <td>21420</td>
      <td>130390</td>
      <td>203050</td>
      <td>1213200</td>
      <td>2514400</td>
      <td>472800</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">crimes = crime.resample(<span class="string">'10AS'</span>).sum()</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">population = crime[<span class="string">'Population'</span>].resample(<span class="string">'10AS'</span>).max()</span><br><span class="line">crimes[<span class="string">'Population'</span>] = population</span><br><span class="line">crimes</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Population</th>
      <th>Violent</th>
      <th>Property</th>
      <th>Murder</th>
      <th>Forcible_Rape</th>
      <th>Robbery</th>
      <th>Aggravated_assault</th>
      <th>Burglary</th>
      <th>Larceny_Theft</th>
      <th>Vehicle_Theft</th>
    </tr>
    <tr>
      <th>Year</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1960-01-01</th>
      <td>201385000</td>
      <td>4134930</td>
      <td>45160900</td>
      <td>106180</td>
      <td>236720</td>
      <td>1633510</td>
      <td>2158520</td>
      <td>13321100</td>
      <td>26547700</td>
      <td>5292100</td>
    </tr>
    <tr>
      <th>1970-01-01</th>
      <td>220099000</td>
      <td>9607930</td>
      <td>91383800</td>
      <td>192230</td>
      <td>554570</td>
      <td>4159020</td>
      <td>4702120</td>
      <td>28486000</td>
      <td>53157800</td>
      <td>9739900</td>
    </tr>
    <tr>
      <th>1980-01-01</th>
      <td>248239000</td>
      <td>14074328</td>
      <td>117048900</td>
      <td>206439</td>
      <td>865639</td>
      <td>5383109</td>
      <td>7619130</td>
      <td>33073494</td>
      <td>72040253</td>
      <td>11935411</td>
    </tr>
    <tr>
      <th>1990-01-01</th>
      <td>272690813</td>
      <td>17527048</td>
      <td>119053499</td>
      <td>211664</td>
      <td>998827</td>
      <td>5748930</td>
      <td>10568963</td>
      <td>26750015</td>
      <td>77679366</td>
      <td>14624418</td>
    </tr>
    <tr>
      <th>2000-01-01</th>
      <td>307006550</td>
      <td>13968056</td>
      <td>100944369</td>
      <td>163068</td>
      <td>922499</td>
      <td>4230366</td>
      <td>8652124</td>
      <td>21565176</td>
      <td>67970291</td>
      <td>11412834</td>
    </tr>
    <tr>
      <th>2010-01-01</th>
      <td>318857056</td>
      <td>6072017</td>
      <td>44095950</td>
      <td>72867</td>
      <td>421059</td>
      <td>1749809</td>
      <td>3764142</td>
      <td>10125170</td>
      <td>30401698</td>
      <td>3569080</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">crime.idxmax(<span class="number">0</span>)</span><br></pre></td></tr></table></figure>




<pre><code>Population           2014-01-01
Violent              1992-01-01
Property             1991-01-01
Murder               1991-01-01
Forcible_Rape        1992-01-01
Robbery              1991-01-01
Aggravated_assault   1993-01-01
Burglary             1980-01-01
Larceny_Theft        1991-01-01
Vehicle_Theft        1991-01-01
dtype: datetime64[ns]</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#探索虚拟姓名数据(练习五)</span></span><br><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 运行以下代码</span></span><br><span class="line">raw_data_1 = &#123;</span><br><span class="line">        <span class="string">'subject_id'</span>: [<span class="string">'1'</span>, <span class="string">'2'</span>, <span class="string">'3'</span>, <span class="string">'4'</span>, <span class="string">'5'</span>],</span><br><span class="line">        <span class="string">'first_name'</span>: [<span class="string">'Alex'</span>, <span class="string">'Amy'</span>, <span class="string">'Allen'</span>, <span class="string">'Alice'</span>, <span class="string">'Ayoung'</span>], </span><br><span class="line">        <span class="string">'last_name'</span>: [<span class="string">'Anderson'</span>, <span class="string">'Ackerman'</span>, <span class="string">'Ali'</span>, <span class="string">'Aoni'</span>, <span class="string">'Atiches'</span>]&#125;</span><br><span class="line"></span><br><span class="line">raw_data_2 = &#123;</span><br><span class="line">        <span class="string">'subject_id'</span>: [<span class="string">'4'</span>, <span class="string">'5'</span>, <span class="string">'6'</span>, <span class="string">'7'</span>, <span class="string">'8'</span>],</span><br><span class="line">        <span class="string">'first_name'</span>: [<span class="string">'Billy'</span>, <span class="string">'Brian'</span>, <span class="string">'Bran'</span>, <span class="string">'Bryce'</span>, <span class="string">'Betty'</span>], </span><br><span class="line">        <span class="string">'last_name'</span>: [<span class="string">'Bonder'</span>, <span class="string">'Black'</span>, <span class="string">'Balwner'</span>, <span class="string">'Brice'</span>, <span class="string">'Btisan'</span>]&#125;</span><br><span class="line"></span><br><span class="line">raw_data_3 = &#123;</span><br><span class="line">        <span class="string">'subject_id'</span>: [<span class="string">'1'</span>, <span class="string">'2'</span>, <span class="string">'3'</span>, <span class="string">'4'</span>, <span class="string">'5'</span>, <span class="string">'7'</span>, <span class="string">'8'</span>, <span class="string">'9'</span>, <span class="string">'10'</span>, <span class="string">'11'</span>],</span><br><span class="line">        <span class="string">'test_id'</span>: [<span class="number">51</span>, <span class="number">15</span>, <span class="number">15</span>, <span class="number">61</span>, <span class="number">16</span>, <span class="number">14</span>, <span class="number">15</span>, <span class="number">1</span>, <span class="number">61</span>, <span class="number">16</span>]&#125;</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">data1 = pd.DataFrame(raw_data_1,columns=[<span class="string">'subject_id'</span>,<span class="string">'first_name'</span>,<span class="string">'last_name'</span>])</span><br><span class="line">data2 = pd.DataFrame(raw_data_2,columns=[<span class="string">'subject_id'</span>,<span class="string">'first_name'</span>,<span class="string">'last_name'</span>])</span><br><span class="line">data3 = pd.DataFrame(raw_data_3,columns=[<span class="string">'subject_id'</span>,<span class="string">'test_id'</span>])</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">all_data = pd.concat([data1,data2])</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">all_data</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>subject_id</th>
      <th>first_name</th>
      <th>last_name</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1</td>
      <td>Alex</td>
      <td>Anderson</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2</td>
      <td>Amy</td>
      <td>Ackerman</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3</td>
      <td>Allen</td>
      <td>Ali</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4</td>
      <td>Alice</td>
      <td>Aoni</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5</td>
      <td>Ayoung</td>
      <td>Atiches</td>
    </tr>
    <tr>
      <th>0</th>
      <td>4</td>
      <td>Billy</td>
      <td>Bonder</td>
    </tr>
    <tr>
      <th>1</th>
      <td>5</td>
      <td>Brian</td>
      <td>Black</td>
    </tr>
    <tr>
      <th>2</th>
      <td>6</td>
      <td>Bran</td>
      <td>Balwner</td>
    </tr>
    <tr>
      <th>3</th>
      <td>7</td>
      <td>Bryce</td>
      <td>Brice</td>
    </tr>
    <tr>
      <th>4</th>
      <td>8</td>
      <td>Betty</td>
      <td>Btisan</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">all_data_col = pd.concat([data1,data2],axis=<span class="number">1</span>)</span><br><span class="line">all_data_col</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>subject_id</th>
      <th>first_name</th>
      <th>last_name</th>
      <th>subject_id</th>
      <th>first_name</th>
      <th>last_name</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1</td>
      <td>Alex</td>
      <td>Anderson</td>
      <td>4</td>
      <td>Billy</td>
      <td>Bonder</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2</td>
      <td>Amy</td>
      <td>Ackerman</td>
      <td>5</td>
      <td>Brian</td>
      <td>Black</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3</td>
      <td>Allen</td>
      <td>Ali</td>
      <td>6</td>
      <td>Bran</td>
      <td>Balwner</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4</td>
      <td>Alice</td>
      <td>Aoni</td>
      <td>7</td>
      <td>Bryce</td>
      <td>Brice</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5</td>
      <td>Ayoung</td>
      <td>Atiches</td>
      <td>8</td>
      <td>Betty</td>
      <td>Btisan</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">data3</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>subject_id</th>
      <th>test_id</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1</td>
      <td>51</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2</td>
      <td>15</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3</td>
      <td>15</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4</td>
      <td>61</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5</td>
      <td>16</td>
    </tr>
    <tr>
      <th>5</th>
      <td>7</td>
      <td>14</td>
    </tr>
    <tr>
      <th>6</th>
      <td>8</td>
      <td>15</td>
    </tr>
    <tr>
      <th>7</th>
      <td>9</td>
      <td>1</td>
    </tr>
    <tr>
      <th>8</th>
      <td>10</td>
      <td>61</td>
    </tr>
    <tr>
      <th>9</th>
      <td>11</td>
      <td>16</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pd.merge(all_data,data3,on=<span class="string">'subject_id'</span>)</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>subject_id</th>
      <th>first_name</th>
      <th>last_name</th>
      <th>test_id</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1</td>
      <td>Alex</td>
      <td>Anderson</td>
      <td>51</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2</td>
      <td>Amy</td>
      <td>Ackerman</td>
      <td>15</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3</td>
      <td>Allen</td>
      <td>Ali</td>
      <td>15</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4</td>
      <td>Alice</td>
      <td>Aoni</td>
      <td>61</td>
    </tr>
    <tr>
      <th>4</th>
      <td>4</td>
      <td>Billy</td>
      <td>Bonder</td>
      <td>61</td>
    </tr>
    <tr>
      <th>5</th>
      <td>5</td>
      <td>Ayoung</td>
      <td>Atiches</td>
      <td>16</td>
    </tr>
    <tr>
      <th>6</th>
      <td>5</td>
      <td>Brian</td>
      <td>Black</td>
      <td>16</td>
    </tr>
    <tr>
      <th>7</th>
      <td>7</td>
      <td>Bryce</td>
      <td>Brice</td>
      <td>14</td>
    </tr>
    <tr>
      <th>8</th>
      <td>8</td>
      <td>Betty</td>
      <td>Btisan</td>
      <td>15</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pd.merge(data1,data2,on=<span class="string">'subject_id'</span>,how=<span class="string">'inner'</span>)</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>subject_id</th>
      <th>first_name_x</th>
      <th>last_name_x</th>
      <th>first_name_y</th>
      <th>last_name_y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>4</td>
      <td>Alice</td>
      <td>Aoni</td>
      <td>Billy</td>
      <td>Bonder</td>
    </tr>
    <tr>
      <th>1</th>
      <td>5</td>
      <td>Ayoung</td>
      <td>Atiches</td>
      <td>Brian</td>
      <td>Black</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pd.merge(data1,data2,on=<span class="string">'subject_id'</span>,how=<span class="string">'outer'</span>)</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>subject_id</th>
      <th>first_name_x</th>
      <th>last_name_x</th>
      <th>first_name_y</th>
      <th>last_name_y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1</td>
      <td>Alex</td>
      <td>Anderson</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2</td>
      <td>Amy</td>
      <td>Ackerman</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3</td>
      <td>Allen</td>
      <td>Ali</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4</td>
      <td>Alice</td>
      <td>Aoni</td>
      <td>Billy</td>
      <td>Bonder</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5</td>
      <td>Ayoung</td>
      <td>Atiches</td>
      <td>Brian</td>
      <td>Black</td>
    </tr>
    <tr>
      <th>5</th>
      <td>6</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>Bran</td>
      <td>Balwner</td>
    </tr>
    <tr>
      <th>6</th>
      <td>7</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>Bryce</td>
      <td>Brice</td>
    </tr>
    <tr>
      <th>7</th>
      <td>8</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>Betty</td>
      <td>Btisan</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#探索风速数据（练习6）</span></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"><span class="keyword">import</span> datetime</span><br><span class="line"></span><br><span class="line">data = pd.read_csv(<span class="string">'wind.data'</span>,sep = <span class="string">'\s+'</span>,parse_dates = [[<span class="number">0</span>,<span class="number">1</span>,<span class="number">2</span>]])</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">data.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Yr_Mo_Dy</th>
      <th>RPT</th>
      <th>VAL</th>
      <th>ROS</th>
      <th>KIL</th>
      <th>SHA</th>
      <th>BIR</th>
      <th>DUB</th>
      <th>CLA</th>
      <th>MUL</th>
      <th>CLO</th>
      <th>BEL</th>
      <th>MAL</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>2061-01-01</td>
      <td>15.04</td>
      <td>14.96</td>
      <td>13.17</td>
      <td>9.29</td>
      <td>NaN</td>
      <td>9.87</td>
      <td>13.67</td>
      <td>10.25</td>
      <td>10.83</td>
      <td>12.58</td>
      <td>18.50</td>
      <td>15.04</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2061-01-02</td>
      <td>14.71</td>
      <td>NaN</td>
      <td>10.83</td>
      <td>6.50</td>
      <td>12.62</td>
      <td>7.67</td>
      <td>11.50</td>
      <td>10.04</td>
      <td>9.79</td>
      <td>9.67</td>
      <td>17.54</td>
      <td>13.83</td>
    </tr>
    <tr>
      <th>2</th>
      <td>2061-01-03</td>
      <td>18.50</td>
      <td>16.88</td>
      <td>12.33</td>
      <td>10.13</td>
      <td>11.17</td>
      <td>6.17</td>
      <td>11.25</td>
      <td>NaN</td>
      <td>8.50</td>
      <td>7.67</td>
      <td>12.75</td>
      <td>12.71</td>
    </tr>
    <tr>
      <th>3</th>
      <td>2061-01-04</td>
      <td>10.58</td>
      <td>6.63</td>
      <td>11.75</td>
      <td>4.58</td>
      <td>4.54</td>
      <td>2.88</td>
      <td>8.63</td>
      <td>1.79</td>
      <td>5.83</td>
      <td>5.88</td>
      <td>5.46</td>
      <td>10.88</td>
    </tr>
    <tr>
      <th>4</th>
      <td>2061-01-05</td>
      <td>13.33</td>
      <td>13.25</td>
      <td>11.42</td>
      <td>6.17</td>
      <td>10.71</td>
      <td>8.21</td>
      <td>11.92</td>
      <td>6.54</td>
      <td>10.92</td>
      <td>10.34</td>
      <td>12.92</td>
      <td>11.83</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">fix_century</span><span class="params">(x)</span>:</span></span><br><span class="line">    year = x.year - <span class="number">100</span> <span class="keyword">if</span> x.year &gt; <span class="number">1989</span> <span class="keyword">else</span> x.year</span><br><span class="line">    <span class="keyword">return</span> datetime.date(year,x.month,x.day)</span><br><span class="line">data[<span class="string">'Yr_Mo_Dy'</span>] = data[<span class="string">'Yr_Mo_Dy'</span>].apply(fix_century)</span><br><span class="line">data.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Yr_Mo_Dy</th>
      <th>RPT</th>
      <th>VAL</th>
      <th>ROS</th>
      <th>KIL</th>
      <th>SHA</th>
      <th>BIR</th>
      <th>DUB</th>
      <th>CLA</th>
      <th>MUL</th>
      <th>CLO</th>
      <th>BEL</th>
      <th>MAL</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1961-01-01</td>
      <td>15.04</td>
      <td>14.96</td>
      <td>13.17</td>
      <td>9.29</td>
      <td>NaN</td>
      <td>9.87</td>
      <td>13.67</td>
      <td>10.25</td>
      <td>10.83</td>
      <td>12.58</td>
      <td>18.50</td>
      <td>15.04</td>
    </tr>
    <tr>
      <th>1</th>
      <td>1961-01-02</td>
      <td>14.71</td>
      <td>NaN</td>
      <td>10.83</td>
      <td>6.50</td>
      <td>12.62</td>
      <td>7.67</td>
      <td>11.50</td>
      <td>10.04</td>
      <td>9.79</td>
      <td>9.67</td>
      <td>17.54</td>
      <td>13.83</td>
    </tr>
    <tr>
      <th>2</th>
      <td>1961-01-03</td>
      <td>18.50</td>
      <td>16.88</td>
      <td>12.33</td>
      <td>10.13</td>
      <td>11.17</td>
      <td>6.17</td>
      <td>11.25</td>
      <td>NaN</td>
      <td>8.50</td>
      <td>7.67</td>
      <td>12.75</td>
      <td>12.71</td>
    </tr>
    <tr>
      <th>3</th>
      <td>1961-01-04</td>
      <td>10.58</td>
      <td>6.63</td>
      <td>11.75</td>
      <td>4.58</td>
      <td>4.54</td>
      <td>2.88</td>
      <td>8.63</td>
      <td>1.79</td>
      <td>5.83</td>
      <td>5.88</td>
      <td>5.46</td>
      <td>10.88</td>
    </tr>
    <tr>
      <th>4</th>
      <td>1961-01-05</td>
      <td>13.33</td>
      <td>13.25</td>
      <td>11.42</td>
      <td>6.17</td>
      <td>10.71</td>
      <td>8.21</td>
      <td>11.92</td>
      <td>6.54</td>
      <td>10.92</td>
      <td>10.34</td>
      <td>12.92</td>
      <td>11.83</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">data[<span class="string">'Yr_Mo_Dy'</span>] = pd.to_datetime(data[<span class="string">'Yr_Mo_Dy'</span>])</span><br><span class="line">data = data.set_index(<span class="string">'Yr_Mo_Dy'</span>)</span><br><span class="line">data.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>RPT</th>
      <th>VAL</th>
      <th>ROS</th>
      <th>KIL</th>
      <th>SHA</th>
      <th>BIR</th>
      <th>DUB</th>
      <th>CLA</th>
      <th>MUL</th>
      <th>CLO</th>
      <th>BEL</th>
      <th>MAL</th>
    </tr>
    <tr>
      <th>Yr_Mo_Dy</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1961-01-01</th>
      <td>15.04</td>
      <td>14.96</td>
      <td>13.17</td>
      <td>9.29</td>
      <td>NaN</td>
      <td>9.87</td>
      <td>13.67</td>
      <td>10.25</td>
      <td>10.83</td>
      <td>12.58</td>
      <td>18.50</td>
      <td>15.04</td>
    </tr>
    <tr>
      <th>1961-01-02</th>
      <td>14.71</td>
      <td>NaN</td>
      <td>10.83</td>
      <td>6.50</td>
      <td>12.62</td>
      <td>7.67</td>
      <td>11.50</td>
      <td>10.04</td>
      <td>9.79</td>
      <td>9.67</td>
      <td>17.54</td>
      <td>13.83</td>
    </tr>
    <tr>
      <th>1961-01-03</th>
      <td>18.50</td>
      <td>16.88</td>
      <td>12.33</td>
      <td>10.13</td>
      <td>11.17</td>
      <td>6.17</td>
      <td>11.25</td>
      <td>NaN</td>
      <td>8.50</td>
      <td>7.67</td>
      <td>12.75</td>
      <td>12.71</td>
    </tr>
    <tr>
      <th>1961-01-04</th>
      <td>10.58</td>
      <td>6.63</td>
      <td>11.75</td>
      <td>4.58</td>
      <td>4.54</td>
      <td>2.88</td>
      <td>8.63</td>
      <td>1.79</td>
      <td>5.83</td>
      <td>5.88</td>
      <td>5.46</td>
      <td>10.88</td>
    </tr>
    <tr>
      <th>1961-01-05</th>
      <td>13.33</td>
      <td>13.25</td>
      <td>11.42</td>
      <td>6.17</td>
      <td>10.71</td>
      <td>8.21</td>
      <td>11.92</td>
      <td>6.54</td>
      <td>10.92</td>
      <td>10.34</td>
      <td>12.92</td>
      <td>11.83</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">data.info()</span><br></pre></td></tr></table></figure>

<pre><code>&lt;class &apos;pandas.core.frame.DataFrame&apos;&gt;
DatetimeIndex: 6574 entries, 1961-01-01 to 1978-12-31
Data columns (total 12 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   RPT     6568 non-null   float64
 1   VAL     6571 non-null   float64
 2   ROS     6572 non-null   float64
 3   KIL     6569 non-null   float64
 4   SHA     6572 non-null   float64
 5   BIR     6574 non-null   float64
 6   DUB     6571 non-null   float64
 7   CLA     6572 non-null   float64
 8   MUL     6571 non-null   float64
 9   CLO     6573 non-null   float64
 10  BEL     6574 non-null   float64
 11  MAL     6570 non-null   float64
dtypes: float64(12)
memory usage: 667.7 KB</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">data.isnull().sum()</span><br></pre></td></tr></table></figure>




<pre><code>RPT    6
VAL    3
ROS    2
KIL    5
SHA    2
BIR    0
DUB    3
CLA    2
MUL    3
CLO    1
BEL    0
MAL    4
dtype: int64</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">data.notnull().sum()</span><br></pre></td></tr></table></figure>




<pre><code>RPT    6568
VAL    6571
ROS    6572
KIL    6569
SHA    6572
BIR    6574
DUB    6571
CLA    6572
MUL    6571
CLO    6573
BEL    6574
MAL    6570
dtype: int64</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">data.mean().mean()</span><br></pre></td></tr></table></figure>




<pre><code>10.227982360836924</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">loc_stats = pd.DataFrame()</span><br><span class="line">loc_stats[<span class="string">'min'</span>] = data.min()</span><br><span class="line">loc_stats[<span class="string">'max'</span>] = data.max()</span><br><span class="line">loc_stats[<span class="string">'mean'</span>] = data.mean()</span><br><span class="line">loc_stats[<span class="string">'std'</span>] = data.std()</span><br><span class="line">loc_stats</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>min</th>
      <th>max</th>
      <th>mean</th>
      <th>std</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>RPT</th>
      <td>0.67</td>
      <td>35.80</td>
      <td>12.362987</td>
      <td>5.618413</td>
    </tr>
    <tr>
      <th>VAL</th>
      <td>0.21</td>
      <td>33.37</td>
      <td>10.644314</td>
      <td>5.267356</td>
    </tr>
    <tr>
      <th>ROS</th>
      <td>1.50</td>
      <td>33.84</td>
      <td>11.660526</td>
      <td>5.008450</td>
    </tr>
    <tr>
      <th>KIL</th>
      <td>0.00</td>
      <td>28.46</td>
      <td>6.306468</td>
      <td>3.605811</td>
    </tr>
    <tr>
      <th>SHA</th>
      <td>0.13</td>
      <td>37.54</td>
      <td>10.455834</td>
      <td>4.936125</td>
    </tr>
    <tr>
      <th>BIR</th>
      <td>0.00</td>
      <td>26.16</td>
      <td>7.092254</td>
      <td>3.968683</td>
    </tr>
    <tr>
      <th>DUB</th>
      <td>0.00</td>
      <td>30.37</td>
      <td>9.797343</td>
      <td>4.977555</td>
    </tr>
    <tr>
      <th>CLA</th>
      <td>0.00</td>
      <td>31.08</td>
      <td>8.495053</td>
      <td>4.499449</td>
    </tr>
    <tr>
      <th>MUL</th>
      <td>0.00</td>
      <td>25.88</td>
      <td>8.493590</td>
      <td>4.166872</td>
    </tr>
    <tr>
      <th>CLO</th>
      <td>0.04</td>
      <td>28.21</td>
      <td>8.707332</td>
      <td>4.503954</td>
    </tr>
    <tr>
      <th>BEL</th>
      <td>0.13</td>
      <td>42.38</td>
      <td>13.121007</td>
      <td>5.835037</td>
    </tr>
    <tr>
      <th>MAL</th>
      <td>0.67</td>
      <td>42.54</td>
      <td>15.599079</td>
      <td>6.699794</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">loc_stats_col = pd.DataFrame()</span><br><span class="line">loc_stats_col[<span class="string">'min'</span>] = data.min(<span class="number">1</span>)</span><br><span class="line">loc_stats_col[<span class="string">'max'</span>] = data.max(<span class="number">1</span>)</span><br><span class="line">loc_stats_col[<span class="string">'mean'</span>] = data.mean(<span class="number">1</span>)</span><br><span class="line">loc_stats_col[<span class="string">'std'</span>] = data.std(<span class="number">1</span>)</span><br><span class="line">loc_stats_col.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>min</th>
      <th>max</th>
      <th>mean</th>
      <th>std</th>
    </tr>
    <tr>
      <th>Yr_Mo_Dy</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1961-01-01</th>
      <td>9.29</td>
      <td>18.50</td>
      <td>13.018182</td>
      <td>2.808875</td>
    </tr>
    <tr>
      <th>1961-01-02</th>
      <td>6.50</td>
      <td>17.54</td>
      <td>11.336364</td>
      <td>3.188994</td>
    </tr>
    <tr>
      <th>1961-01-03</th>
      <td>6.17</td>
      <td>18.50</td>
      <td>11.641818</td>
      <td>3.681912</td>
    </tr>
    <tr>
      <th>1961-01-04</th>
      <td>1.79</td>
      <td>11.75</td>
      <td>6.619167</td>
      <td>3.198126</td>
    </tr>
    <tr>
      <th>1961-01-05</th>
      <td>6.17</td>
      <td>13.33</td>
      <td>10.630000</td>
      <td>2.445356</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">data[<span class="string">'date'</span>] = data.index</span><br><span class="line">data[<span class="string">'month'</span>] = data[<span class="string">'date'</span>].apply(<span class="keyword">lambda</span> date:date.month)</span><br><span class="line">data[<span class="string">'year'</span>] = data[<span class="string">'date'</span>].apply(<span class="keyword">lambda</span> date:date.year)</span><br><span class="line">data[<span class="string">'day'</span>] = data[<span class="string">'date'</span>].apply(<span class="keyword">lambda</span> date:date.day)</span><br><span class="line"></span><br><span class="line">january_wind = data.query(<span class="string">'month == 1'</span>)</span><br><span class="line">january_wind</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>RPT</th>
      <th>VAL</th>
      <th>ROS</th>
      <th>KIL</th>
      <th>SHA</th>
      <th>BIR</th>
      <th>DUB</th>
      <th>CLA</th>
      <th>MUL</th>
      <th>CLO</th>
      <th>BEL</th>
      <th>MAL</th>
      <th>date</th>
      <th>month</th>
      <th>year</th>
      <th>day</th>
    </tr>
    <tr>
      <th>Yr_Mo_Dy</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1961-01-01</th>
      <td>15.04</td>
      <td>14.96</td>
      <td>13.17</td>
      <td>9.29</td>
      <td>NaN</td>
      <td>9.87</td>
      <td>13.67</td>
      <td>10.25</td>
      <td>10.83</td>
      <td>12.58</td>
      <td>18.50</td>
      <td>15.04</td>
      <td>1961-01-01</td>
      <td>1</td>
      <td>1961</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1961-01-02</th>
      <td>14.71</td>
      <td>NaN</td>
      <td>10.83</td>
      <td>6.50</td>
      <td>12.62</td>
      <td>7.67</td>
      <td>11.50</td>
      <td>10.04</td>
      <td>9.79</td>
      <td>9.67</td>
      <td>17.54</td>
      <td>13.83</td>
      <td>1961-01-02</td>
      <td>1</td>
      <td>1961</td>
      <td>2</td>
    </tr>
    <tr>
      <th>1961-01-03</th>
      <td>18.50</td>
      <td>16.88</td>
      <td>12.33</td>
      <td>10.13</td>
      <td>11.17</td>
      <td>6.17</td>
      <td>11.25</td>
      <td>NaN</td>
      <td>8.50</td>
      <td>7.67</td>
      <td>12.75</td>
      <td>12.71</td>
      <td>1961-01-03</td>
      <td>1</td>
      <td>1961</td>
      <td>3</td>
    </tr>
    <tr>
      <th>1961-01-04</th>
      <td>10.58</td>
      <td>6.63</td>
      <td>11.75</td>
      <td>4.58</td>
      <td>4.54</td>
      <td>2.88</td>
      <td>8.63</td>
      <td>1.79</td>
      <td>5.83</td>
      <td>5.88</td>
      <td>5.46</td>
      <td>10.88</td>
      <td>1961-01-04</td>
      <td>1</td>
      <td>1961</td>
      <td>4</td>
    </tr>
    <tr>
      <th>1961-01-05</th>
      <td>13.33</td>
      <td>13.25</td>
      <td>11.42</td>
      <td>6.17</td>
      <td>10.71</td>
      <td>8.21</td>
      <td>11.92</td>
      <td>6.54</td>
      <td>10.92</td>
      <td>10.34</td>
      <td>12.92</td>
      <td>11.83</td>
      <td>1961-01-05</td>
      <td>1</td>
      <td>1961</td>
      <td>5</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>1978-01-27</th>
      <td>18.54</td>
      <td>9.59</td>
      <td>15.67</td>
      <td>6.42</td>
      <td>10.34</td>
      <td>7.04</td>
      <td>11.63</td>
      <td>9.38</td>
      <td>9.46</td>
      <td>7.58</td>
      <td>11.42</td>
      <td>24.87</td>
      <td>1978-01-27</td>
      <td>1</td>
      <td>1978</td>
      <td>27</td>
    </tr>
    <tr>
      <th>1978-01-28</th>
      <td>35.38</td>
      <td>29.88</td>
      <td>18.00</td>
      <td>15.96</td>
      <td>26.92</td>
      <td>15.67</td>
      <td>15.87</td>
      <td>26.34</td>
      <td>15.04</td>
      <td>17.75</td>
      <td>34.42</td>
      <td>35.83</td>
      <td>1978-01-28</td>
      <td>1</td>
      <td>1978</td>
      <td>28</td>
    </tr>
    <tr>
      <th>1978-01-29</th>
      <td>29.38</td>
      <td>18.54</td>
      <td>28.08</td>
      <td>17.12</td>
      <td>17.50</td>
      <td>13.75</td>
      <td>25.54</td>
      <td>15.67</td>
      <td>18.08</td>
      <td>20.50</td>
      <td>19.12</td>
      <td>38.20</td>
      <td>1978-01-29</td>
      <td>1</td>
      <td>1978</td>
      <td>29</td>
    </tr>
    <tr>
      <th>1978-01-30</th>
      <td>9.62</td>
      <td>8.71</td>
      <td>9.59</td>
      <td>2.71</td>
      <td>7.58</td>
      <td>3.54</td>
      <td>6.08</td>
      <td>6.08</td>
      <td>5.33</td>
      <td>4.46</td>
      <td>10.41</td>
      <td>12.83</td>
      <td>1978-01-30</td>
      <td>1</td>
      <td>1978</td>
      <td>30</td>
    </tr>
    <tr>
      <th>1978-01-31</th>
      <td>10.50</td>
      <td>8.79</td>
      <td>9.54</td>
      <td>4.42</td>
      <td>10.58</td>
      <td>5.46</td>
      <td>8.00</td>
      <td>5.71</td>
      <td>6.50</td>
      <td>6.38</td>
      <td>6.54</td>
      <td>17.37</td>
      <td>1978-01-31</td>
      <td>1</td>
      <td>1978</td>
      <td>31</td>
    </tr>
  </tbody>
</table>
<p>558 rows × 16 columns</p>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">data.query(<span class="string">'month == 1 and day == 1'</span>)</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>RPT</th>
      <th>VAL</th>
      <th>ROS</th>
      <th>KIL</th>
      <th>SHA</th>
      <th>BIR</th>
      <th>DUB</th>
      <th>CLA</th>
      <th>MUL</th>
      <th>CLO</th>
      <th>BEL</th>
      <th>MAL</th>
      <th>date</th>
      <th>month</th>
      <th>year</th>
      <th>day</th>
    </tr>
    <tr>
      <th>Yr_Mo_Dy</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1961-01-01</th>
      <td>15.04</td>
      <td>14.96</td>
      <td>13.17</td>
      <td>9.29</td>
      <td>NaN</td>
      <td>9.87</td>
      <td>13.67</td>
      <td>10.25</td>
      <td>10.83</td>
      <td>12.58</td>
      <td>18.50</td>
      <td>15.04</td>
      <td>1961-01-01</td>
      <td>1</td>
      <td>1961</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1962-01-01</th>
      <td>9.29</td>
      <td>3.42</td>
      <td>11.54</td>
      <td>3.50</td>
      <td>2.21</td>
      <td>1.96</td>
      <td>10.41</td>
      <td>2.79</td>
      <td>3.54</td>
      <td>5.17</td>
      <td>4.38</td>
      <td>7.92</td>
      <td>1962-01-01</td>
      <td>1</td>
      <td>1962</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1963-01-01</th>
      <td>15.59</td>
      <td>13.62</td>
      <td>19.79</td>
      <td>8.38</td>
      <td>12.25</td>
      <td>10.00</td>
      <td>23.45</td>
      <td>15.71</td>
      <td>13.59</td>
      <td>14.37</td>
      <td>17.58</td>
      <td>34.13</td>
      <td>1963-01-01</td>
      <td>1</td>
      <td>1963</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1964-01-01</th>
      <td>25.80</td>
      <td>22.13</td>
      <td>18.21</td>
      <td>13.25</td>
      <td>21.29</td>
      <td>14.79</td>
      <td>14.12</td>
      <td>19.58</td>
      <td>13.25</td>
      <td>16.75</td>
      <td>28.96</td>
      <td>21.00</td>
      <td>1964-01-01</td>
      <td>1</td>
      <td>1964</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1965-01-01</th>
      <td>9.54</td>
      <td>11.92</td>
      <td>9.00</td>
      <td>4.38</td>
      <td>6.08</td>
      <td>5.21</td>
      <td>10.25</td>
      <td>6.08</td>
      <td>5.71</td>
      <td>8.63</td>
      <td>12.04</td>
      <td>17.41</td>
      <td>1965-01-01</td>
      <td>1</td>
      <td>1965</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1966-01-01</th>
      <td>22.04</td>
      <td>21.50</td>
      <td>17.08</td>
      <td>12.75</td>
      <td>22.17</td>
      <td>15.59</td>
      <td>21.79</td>
      <td>18.12</td>
      <td>16.66</td>
      <td>17.83</td>
      <td>28.33</td>
      <td>23.79</td>
      <td>1966-01-01</td>
      <td>1</td>
      <td>1966</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1967-01-01</th>
      <td>6.46</td>
      <td>4.46</td>
      <td>6.50</td>
      <td>3.21</td>
      <td>6.67</td>
      <td>3.79</td>
      <td>11.38</td>
      <td>3.83</td>
      <td>7.71</td>
      <td>9.08</td>
      <td>10.67</td>
      <td>20.91</td>
      <td>1967-01-01</td>
      <td>1</td>
      <td>1967</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1968-01-01</th>
      <td>30.04</td>
      <td>17.88</td>
      <td>16.25</td>
      <td>16.25</td>
      <td>21.79</td>
      <td>12.54</td>
      <td>18.16</td>
      <td>16.62</td>
      <td>18.75</td>
      <td>17.62</td>
      <td>22.25</td>
      <td>27.29</td>
      <td>1968-01-01</td>
      <td>1</td>
      <td>1968</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1969-01-01</th>
      <td>6.13</td>
      <td>1.63</td>
      <td>5.41</td>
      <td>1.08</td>
      <td>2.54</td>
      <td>1.00</td>
      <td>8.50</td>
      <td>2.42</td>
      <td>4.58</td>
      <td>6.34</td>
      <td>9.17</td>
      <td>16.71</td>
      <td>1969-01-01</td>
      <td>1</td>
      <td>1969</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1970-01-01</th>
      <td>9.59</td>
      <td>2.96</td>
      <td>11.79</td>
      <td>3.42</td>
      <td>6.13</td>
      <td>4.08</td>
      <td>9.00</td>
      <td>4.46</td>
      <td>7.29</td>
      <td>3.50</td>
      <td>7.33</td>
      <td>13.00</td>
      <td>1970-01-01</td>
      <td>1</td>
      <td>1970</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1971-01-01</th>
      <td>3.71</td>
      <td>0.79</td>
      <td>4.71</td>
      <td>0.17</td>
      <td>1.42</td>
      <td>1.04</td>
      <td>4.63</td>
      <td>0.75</td>
      <td>1.54</td>
      <td>1.08</td>
      <td>4.21</td>
      <td>9.54</td>
      <td>1971-01-01</td>
      <td>1</td>
      <td>1971</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1972-01-01</th>
      <td>9.29</td>
      <td>3.63</td>
      <td>14.54</td>
      <td>4.25</td>
      <td>6.75</td>
      <td>4.42</td>
      <td>13.00</td>
      <td>5.33</td>
      <td>10.04</td>
      <td>8.54</td>
      <td>8.71</td>
      <td>19.17</td>
      <td>1972-01-01</td>
      <td>1</td>
      <td>1972</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1973-01-01</th>
      <td>16.50</td>
      <td>15.92</td>
      <td>14.62</td>
      <td>7.41</td>
      <td>8.29</td>
      <td>11.21</td>
      <td>13.54</td>
      <td>7.79</td>
      <td>10.46</td>
      <td>10.79</td>
      <td>13.37</td>
      <td>9.71</td>
      <td>1973-01-01</td>
      <td>1</td>
      <td>1973</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1974-01-01</th>
      <td>23.21</td>
      <td>16.54</td>
      <td>16.08</td>
      <td>9.75</td>
      <td>15.83</td>
      <td>11.46</td>
      <td>9.54</td>
      <td>13.54</td>
      <td>13.83</td>
      <td>16.66</td>
      <td>17.21</td>
      <td>25.29</td>
      <td>1974-01-01</td>
      <td>1</td>
      <td>1974</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1975-01-01</th>
      <td>14.04</td>
      <td>13.54</td>
      <td>11.29</td>
      <td>5.46</td>
      <td>12.58</td>
      <td>5.58</td>
      <td>8.12</td>
      <td>8.96</td>
      <td>9.29</td>
      <td>5.17</td>
      <td>7.71</td>
      <td>11.63</td>
      <td>1975-01-01</td>
      <td>1</td>
      <td>1975</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1976-01-01</th>
      <td>18.34</td>
      <td>17.67</td>
      <td>14.83</td>
      <td>8.00</td>
      <td>16.62</td>
      <td>10.13</td>
      <td>13.17</td>
      <td>9.04</td>
      <td>13.13</td>
      <td>5.75</td>
      <td>11.38</td>
      <td>14.96</td>
      <td>1976-01-01</td>
      <td>1</td>
      <td>1976</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1977-01-01</th>
      <td>20.04</td>
      <td>11.92</td>
      <td>20.25</td>
      <td>9.13</td>
      <td>9.29</td>
      <td>8.04</td>
      <td>10.75</td>
      <td>5.88</td>
      <td>9.00</td>
      <td>9.00</td>
      <td>14.88</td>
      <td>25.70</td>
      <td>1977-01-01</td>
      <td>1</td>
      <td>1977</td>
      <td>1</td>
    </tr>
    <tr>
      <th>1978-01-01</th>
      <td>8.33</td>
      <td>7.12</td>
      <td>7.71</td>
      <td>3.54</td>
      <td>8.50</td>
      <td>7.50</td>
      <td>14.71</td>
      <td>10.00</td>
      <td>11.83</td>
      <td>10.00</td>
      <td>15.09</td>
      <td>20.46</td>
      <td>1978-01-01</td>
      <td>1</td>
      <td>1978</td>
      <td>1</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment">#探索泰坦尼克号灾难数据（练习7）</span></span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</span><br><span class="line"><span class="keyword">import</span> seaborn <span class="keyword">as</span> sns</span><br><span class="line"></span><br><span class="line">%matplotlib inline</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">titanic = pd.read_csv(<span class="string">'train.csv'</span>)</span><br><span class="line">titanic.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>PassengerId</th>
      <th>Survived</th>
      <th>Pclass</th>
      <th>Name</th>
      <th>Sex</th>
      <th>Age</th>
      <th>SibSp</th>
      <th>Parch</th>
      <th>Ticket</th>
      <th>Fare</th>
      <th>Cabin</th>
      <th>Embarked</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>1</td>
      <td>0</td>
      <td>3</td>
      <td>Braund, Mr. Owen Harris</td>
      <td>male</td>
      <td>22.0</td>
      <td>1</td>
      <td>0</td>
      <td>A/5 21171</td>
      <td>7.2500</td>
      <td>NaN</td>
      <td>S</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2</td>
      <td>1</td>
      <td>1</td>
      <td>Cumings, Mrs. John Bradley (Florence Briggs Th...</td>
      <td>female</td>
      <td>38.0</td>
      <td>1</td>
      <td>0</td>
      <td>PC 17599</td>
      <td>71.2833</td>
      <td>C85</td>
      <td>C</td>
    </tr>
    <tr>
      <th>2</th>
      <td>3</td>
      <td>1</td>
      <td>3</td>
      <td>Heikkinen, Miss. Laina</td>
      <td>female</td>
      <td>26.0</td>
      <td>0</td>
      <td>0</td>
      <td>STON/O2. 3101282</td>
      <td>7.9250</td>
      <td>NaN</td>
      <td>S</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4</td>
      <td>1</td>
      <td>1</td>
      <td>Futrelle, Mrs. Jacques Heath (Lily May Peel)</td>
      <td>female</td>
      <td>35.0</td>
      <td>1</td>
      <td>0</td>
      <td>113803</td>
      <td>53.1000</td>
      <td>C123</td>
      <td>S</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5</td>
      <td>0</td>
      <td>3</td>
      <td>Allen, Mr. William Henry</td>
      <td>male</td>
      <td>35.0</td>
      <td>0</td>
      <td>0</td>
      <td>373450</td>
      <td>8.0500</td>
      <td>NaN</td>
      <td>S</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">del</span> titanic[<span class="string">'Name'</span>]</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">titanic.set_index(<span class="string">'PassengerId'</span>).head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Survived</th>
      <th>Pclass</th>
      <th>Sex</th>
      <th>Age</th>
      <th>SibSp</th>
      <th>Parch</th>
      <th>Ticket</th>
      <th>Fare</th>
      <th>Cabin</th>
      <th>Embarked</th>
    </tr>
    <tr>
      <th>PassengerId</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1</th>
      <td>0</td>
      <td>3</td>
      <td>male</td>
      <td>22.0</td>
      <td>1</td>
      <td>0</td>
      <td>A/5 21171</td>
      <td>7.2500</td>
      <td>NaN</td>
      <td>S</td>
    </tr>
    <tr>
      <th>2</th>
      <td>1</td>
      <td>1</td>
      <td>female</td>
      <td>38.0</td>
      <td>1</td>
      <td>0</td>
      <td>PC 17599</td>
      <td>71.2833</td>
      <td>C85</td>
      <td>C</td>
    </tr>
    <tr>
      <th>3</th>
      <td>1</td>
      <td>3</td>
      <td>female</td>
      <td>26.0</td>
      <td>0</td>
      <td>0</td>
      <td>STON/O2. 3101282</td>
      <td>7.9250</td>
      <td>NaN</td>
      <td>S</td>
    </tr>
    <tr>
      <th>4</th>
      <td>1</td>
      <td>1</td>
      <td>female</td>
      <td>35.0</td>
      <td>1</td>
      <td>0</td>
      <td>113803</td>
      <td>53.1000</td>
      <td>C123</td>
      <td>S</td>
    </tr>
    <tr>
      <th>5</th>
      <td>0</td>
      <td>3</td>
      <td>male</td>
      <td>35.0</td>
      <td>0</td>
      <td>0</td>
      <td>373450</td>
      <td>8.0500</td>
      <td>NaN</td>
      <td>S</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">males = (titanic[<span class="string">'Sex'</span>] == <span class="string">'male'</span>).sum()</span><br><span class="line">females = (titanic[<span class="string">'Sex'</span>] == <span class="string">'female'</span>).sum()</span><br><span class="line">proportions = [males,females]</span><br><span class="line">plt.pie(</span><br><span class="line">    proportions,</span><br><span class="line">    shadow =<span class="literal">False</span>,</span><br><span class="line">    colors=[<span class="string">'blue'</span>,<span class="string">'red'</span>],</span><br><span class="line">    explode=(<span class="number">0.15</span>,<span class="number">0</span>),</span><br><span class="line">    startangle=<span class="number">90</span>,</span><br><span class="line">    autopct=<span class="string">'%1.1f%%'</span></span><br><span class="line">)</span><br><span class="line">plt.axis(<span class="string">'equal'</span>)</span><br><span class="line">plt.title(<span class="string">'Sex Proportion'</span>)</span><br><span class="line"></span><br><span class="line">plt.tight_layout()</span><br><span class="line">plt.show()</span><br></pre></td></tr></table></figure>


<p><img src="/2021/03/31/exercise/output_65_0.png" alt="png"></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">lm = sns.lmplot(x=<span class="string">'Age'</span>,</span><br><span class="line">               y=<span class="string">'Fare'</span>,</span><br><span class="line">               data=titanic,</span><br><span class="line">                hue=<span class="string">'Sex'</span>,</span><br><span class="line">                fit_reg=<span class="literal">False</span></span><br><span class="line">               )</span><br><span class="line">lm.set(title=<span class="string">'Fare x Age'</span>)</span><br><span class="line">axes = lm.axes</span><br><span class="line">axes[<span class="number">0</span>,<span class="number">0</span>].set_ylim(<span class="number">-5</span>,)</span><br><span class="line">axes[<span class="number">0</span>,<span class="number">0</span>].set_xlim(<span class="number">-5</span>,<span class="number">85</span>)</span><br></pre></td></tr></table></figure>




<pre><code>(-5, 85)</code></pre><p><img src="/2021/03/31/exercise/output_66_1.png" alt="png"></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">titanic.Survived.sum()</span><br></pre></td></tr></table></figure>




<pre><code>342</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">df = titanic.Fare.sort_values(ascending=<span class="literal">False</span>)</span><br><span class="line">df</span><br><span class="line"></span><br><span class="line">binsVal = np.arange(<span class="number">0</span>,<span class="number">600</span>,<span class="number">10</span>)</span><br><span class="line">binsVal</span><br><span class="line"></span><br><span class="line">plt.hist(df,bins=binsVal)</span><br><span class="line">plt.xlabel(<span class="string">'Fare'</span>)</span><br><span class="line">plt.ylabel(<span class="string">'Frequency'</span>)</span><br><span class="line">plt.title(<span class="string">'Fare Payed Histrogram'</span>)</span><br><span class="line">plt.show()</span><br></pre></td></tr></table></figure>


<p><img src="/2021/03/31/exercise/output_68_0.png" alt="png"></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#探索Pokemon数据(练习8)</span></span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">raw_data = &#123;<span class="string">"name"</span>: [<span class="string">'Bulbasaur'</span>, <span class="string">'Charmander'</span>,<span class="string">'Squirtle'</span>,<span class="string">'Caterpie'</span>],</span><br><span class="line">            <span class="string">"evolution"</span>: [<span class="string">'Ivysaur'</span>,<span class="string">'Charmeleon'</span>,<span class="string">'Wartortle'</span>,<span class="string">'Metapod'</span>],</span><br><span class="line">            <span class="string">"type"</span>: [<span class="string">'grass'</span>, <span class="string">'fire'</span>, <span class="string">'water'</span>, <span class="string">'bug'</span>],</span><br><span class="line">            <span class="string">"hp"</span>: [<span class="number">45</span>, <span class="number">39</span>, <span class="number">44</span>, <span class="number">45</span>],</span><br><span class="line">            <span class="string">"pokedex"</span>: [<span class="string">'yes'</span>, <span class="string">'no'</span>,<span class="string">'yes'</span>,<span class="string">'no'</span>]                        </span><br><span class="line">            &#125;</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">raw_data</span><br></pre></td></tr></table></figure>




<pre><code>{&apos;name&apos;: [&apos;Bulbasaur&apos;, &apos;Charmander&apos;, &apos;Squirtle&apos;, &apos;Caterpie&apos;],
 &apos;evolution&apos;: [&apos;Ivysaur&apos;, &apos;Charmeleon&apos;, &apos;Wartortle&apos;, &apos;Metapod&apos;],
 &apos;type&apos;: [&apos;grass&apos;, &apos;fire&apos;, &apos;water&apos;, &apos;bug&apos;],
 &apos;hp&apos;: [45, 39, 44, 45],
 &apos;pokedex&apos;: [&apos;yes&apos;, &apos;no&apos;, &apos;yes&apos;, &apos;no&apos;]}</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">pokemon = pd.DataFrame(raw_data)</span><br><span class="line">pokemon.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>name</th>
      <th>evolution</th>
      <th>type</th>
      <th>hp</th>
      <th>pokedex</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Bulbasaur</td>
      <td>Ivysaur</td>
      <td>grass</td>
      <td>45</td>
      <td>yes</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Charmander</td>
      <td>Charmeleon</td>
      <td>fire</td>
      <td>39</td>
      <td>no</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Squirtle</td>
      <td>Wartortle</td>
      <td>water</td>
      <td>44</td>
      <td>yes</td>
    </tr>
    <tr>
      <th>3</th>
      <td>Caterpie</td>
      <td>Metapod</td>
      <td>bug</td>
      <td>45</td>
      <td>no</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">pokemon = pokemon[[<span class="string">'name'</span>,<span class="string">'type'</span>,<span class="string">'hp'</span>,<span class="string">'evolution'</span>,<span class="string">'pokedex'</span>]]</span><br><span class="line">pokemon</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>name</th>
      <th>type</th>
      <th>hp</th>
      <th>evolution</th>
      <th>pokedex</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Bulbasaur</td>
      <td>grass</td>
      <td>45</td>
      <td>Ivysaur</td>
      <td>yes</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Charmander</td>
      <td>fire</td>
      <td>39</td>
      <td>Charmeleon</td>
      <td>no</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Squirtle</td>
      <td>water</td>
      <td>44</td>
      <td>Wartortle</td>
      <td>yes</td>
    </tr>
    <tr>
      <th>3</th>
      <td>Caterpie</td>
      <td>bug</td>
      <td>45</td>
      <td>Metapod</td>
      <td>no</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">pokemon[<span class="string">'place'</span>] = [<span class="string">'park'</span>,<span class="string">'street'</span>,<span class="string">'lake'</span>,<span class="string">'forest'</span>]</span><br><span class="line">pokemon</span><br></pre></td></tr></table></figure>

<pre><code>/root/anaconda3/lib/python3.7/site-packages/ipykernel_launcher.py:1: SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  &quot;&quot;&quot;Entry point for launching an IPython kernel.</code></pre><div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>name</th>
      <th>type</th>
      <th>hp</th>
      <th>evolution</th>
      <th>pokedex</th>
      <th>place</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>Bulbasaur</td>
      <td>grass</td>
      <td>45</td>
      <td>Ivysaur</td>
      <td>yes</td>
      <td>park</td>
    </tr>
    <tr>
      <th>1</th>
      <td>Charmander</td>
      <td>fire</td>
      <td>39</td>
      <td>Charmeleon</td>
      <td>no</td>
      <td>street</td>
    </tr>
    <tr>
      <th>2</th>
      <td>Squirtle</td>
      <td>water</td>
      <td>44</td>
      <td>Wartortle</td>
      <td>yes</td>
      <td>lake</td>
    </tr>
    <tr>
      <th>3</th>
      <td>Caterpie</td>
      <td>bug</td>
      <td>45</td>
      <td>Metapod</td>
      <td>no</td>
      <td>forest</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pokemon.dtypes</span><br></pre></td></tr></table></figure>




<pre><code>name         object
type         object
hp            int64
evolution    object
pokedex      object
place        object
dtype: object</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#探索Apple公司股价数据(练习9)</span></span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line"><span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</span><br><span class="line"></span><br><span class="line">%matplotlib inline</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">apple = pd.read_csv(<span class="string">'Apple_stock.csv'</span>)</span><br><span class="line">apple.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Date</th>
      <th>Open</th>
      <th>High</th>
      <th>Low</th>
      <th>Close</th>
      <th>Volume</th>
      <th>Adj Close</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>2014-07-08</td>
      <td>96.27</td>
      <td>96.80</td>
      <td>93.92</td>
      <td>95.35</td>
      <td>65130000</td>
      <td>95.35</td>
    </tr>
    <tr>
      <th>1</th>
      <td>2014-07-07</td>
      <td>94.14</td>
      <td>95.99</td>
      <td>94.10</td>
      <td>95.97</td>
      <td>56305400</td>
      <td>95.97</td>
    </tr>
    <tr>
      <th>2</th>
      <td>2014-07-03</td>
      <td>93.67</td>
      <td>94.10</td>
      <td>93.20</td>
      <td>94.03</td>
      <td>22891800</td>
      <td>94.03</td>
    </tr>
    <tr>
      <th>3</th>
      <td>2014-07-02</td>
      <td>93.87</td>
      <td>94.06</td>
      <td>93.09</td>
      <td>93.48</td>
      <td>28420900</td>
      <td>93.48</td>
    </tr>
    <tr>
      <th>4</th>
      <td>2014-07-01</td>
      <td>93.52</td>
      <td>94.07</td>
      <td>93.13</td>
      <td>93.52</td>
      <td>38170200</td>
      <td>93.52</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apple.shape</span><br></pre></td></tr></table></figure>




<pre><code>(8465, 7)</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apple.dtypes</span><br></pre></td></tr></table></figure>




<pre><code>Date          object
Open         float64
High         float64
Low          float64
Close        float64
Volume         int64
Adj Close    float64
dtype: object</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">apple.Date = pd.to_datetime(apple.Date)</span><br><span class="line">apple.Date.head()</span><br></pre></td></tr></table></figure>




<pre><code>0   2014-07-08
1   2014-07-07
2   2014-07-03
3   2014-07-02
4   2014-07-01
Name: Date, dtype: datetime64[ns]</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">apple = apple.set_index(<span class="string">'Date'</span>)</span><br><span class="line">apple.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Open</th>
      <th>High</th>
      <th>Low</th>
      <th>Close</th>
      <th>Volume</th>
      <th>Adj Close</th>
    </tr>
    <tr>
      <th>Date</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>2014-07-08</th>
      <td>96.27</td>
      <td>96.80</td>
      <td>93.92</td>
      <td>95.35</td>
      <td>65130000</td>
      <td>95.35</td>
    </tr>
    <tr>
      <th>2014-07-07</th>
      <td>94.14</td>
      <td>95.99</td>
      <td>94.10</td>
      <td>95.97</td>
      <td>56305400</td>
      <td>95.97</td>
    </tr>
    <tr>
      <th>2014-07-03</th>
      <td>93.67</td>
      <td>94.10</td>
      <td>93.20</td>
      <td>94.03</td>
      <td>22891800</td>
      <td>94.03</td>
    </tr>
    <tr>
      <th>2014-07-02</th>
      <td>93.87</td>
      <td>94.06</td>
      <td>93.09</td>
      <td>93.48</td>
      <td>28420900</td>
      <td>93.48</td>
    </tr>
    <tr>
      <th>2014-07-01</th>
      <td>93.52</td>
      <td>94.07</td>
      <td>93.13</td>
      <td>93.52</td>
      <td>38170200</td>
      <td>93.52</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apple.index.is_unique</span><br></pre></td></tr></table></figure>




<pre><code>True</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">apple.sort_index(ascending=<span class="literal">True</span>).head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>Open</th>
      <th>High</th>
      <th>Low</th>
      <th>Close</th>
      <th>Volume</th>
      <th>Adj Close</th>
    </tr>
    <tr>
      <th>Date</th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>1980-12-12</th>
      <td>28.75</td>
      <td>28.87</td>
      <td>28.75</td>
      <td>28.75</td>
      <td>117258400</td>
      <td>0.45</td>
    </tr>
    <tr>
      <th>1980-12-15</th>
      <td>27.38</td>
      <td>27.38</td>
      <td>27.25</td>
      <td>27.25</td>
      <td>43971200</td>
      <td>0.42</td>
    </tr>
    <tr>
      <th>1980-12-16</th>
      <td>25.37</td>
      <td>25.37</td>
      <td>25.25</td>
      <td>25.25</td>
      <td>26432000</td>
      <td>0.39</td>
    </tr>
    <tr>
      <th>1980-12-17</th>
      <td>25.87</td>
      <td>26.00</td>
      <td>25.87</td>
      <td>25.87</td>
      <td>21610400</td>
      <td>0.40</td>
    </tr>
    <tr>
      <th>1980-12-18</th>
      <td>26.63</td>
      <td>26.75</td>
      <td>26.63</td>
      <td>26.63</td>
      <td>18362400</td>
      <td>0.41</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#探索Iris纸鸢花数据（练习10）</span></span><br><span class="line"><span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">iris = pd.read_csv(<span class="string">'iris.csv'</span>)</span><br><span class="line">iris.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>5.1</th>
      <th>3.5</th>
      <th>1.4</th>
      <th>0.2</th>
      <th>Iris-setosa</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>4.9</td>
      <td>3.0</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.7</td>
      <td>3.2</td>
      <td>1.3</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>2</th>
      <td>4.6</td>
      <td>3.1</td>
      <td>1.5</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>3</th>
      <td>5.0</td>
      <td>3.6</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5.4</td>
      <td>3.9</td>
      <td>1.7</td>
      <td>0.4</td>
      <td>Iris-setosa</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">iris.describe()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>5.1</th>
      <th>3.5</th>
      <th>1.4</th>
      <th>0.2</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>count</th>
      <td>149.000000</td>
      <td>149.000000</td>
      <td>149.000000</td>
      <td>149.000000</td>
    </tr>
    <tr>
      <th>mean</th>
      <td>5.848322</td>
      <td>3.051007</td>
      <td>3.774497</td>
      <td>1.205369</td>
    </tr>
    <tr>
      <th>std</th>
      <td>0.828594</td>
      <td>0.433499</td>
      <td>1.759651</td>
      <td>0.761292</td>
    </tr>
    <tr>
      <th>min</th>
      <td>4.300000</td>
      <td>2.000000</td>
      <td>1.000000</td>
      <td>0.100000</td>
    </tr>
    <tr>
      <th>25%</th>
      <td>5.100000</td>
      <td>2.800000</td>
      <td>1.600000</td>
      <td>0.300000</td>
    </tr>
    <tr>
      <th>50%</th>
      <td>5.800000</td>
      <td>3.000000</td>
      <td>4.400000</td>
      <td>1.300000</td>
    </tr>
    <tr>
      <th>75%</th>
      <td>6.400000</td>
      <td>3.300000</td>
      <td>5.100000</td>
      <td>1.800000</td>
    </tr>
    <tr>
      <th>max</th>
      <td>7.900000</td>
      <td>4.400000</td>
      <td>6.900000</td>
      <td>2.500000</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">iris = pd.read_csv(<span class="string">'iris.csv'</span>,names = [<span class="string">'sepal_length'</span>,<span class="string">'sepal_width'</span>, <span class="string">'petal_length'</span>, <span class="string">'petal_width'</span>, <span class="string">'class'</span>])</span><br><span class="line">iris.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>sepal_length</th>
      <th>sepal_width</th>
      <th>petal_length</th>
      <th>petal_width</th>
      <th>class</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>5.1</td>
      <td>3.5</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.9</td>
      <td>3.0</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>2</th>
      <td>4.7</td>
      <td>3.2</td>
      <td>1.3</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4.6</td>
      <td>3.1</td>
      <td>1.5</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5.0</td>
      <td>3.6</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pd.isnull(iris).sum()</span><br></pre></td></tr></table></figure>




<pre><code>sepal_length    0
sepal_width     0
petal_length    0
petal_width     0
class           0
dtype: int64</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">iris.iloc[<span class="number">10</span>:<span class="number">20</span>,<span class="number">2</span>:<span class="number">3</span>] = np.nan</span><br><span class="line">iris.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>sepal_length</th>
      <th>sepal_width</th>
      <th>petal_length</th>
      <th>petal_width</th>
      <th>class</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>5.1</td>
      <td>3.5</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.9</td>
      <td>3.0</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>2</th>
      <td>4.7</td>
      <td>3.2</td>
      <td>1.3</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4.6</td>
      <td>3.1</td>
      <td>1.5</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5.0</td>
      <td>3.6</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">iris.petal_length.fillna(<span class="number">1</span>,inplace=<span class="literal">True</span>)</span><br><span class="line">iris</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>sepal_length</th>
      <th>sepal_width</th>
      <th>petal_length</th>
      <th>petal_width</th>
      <th>class</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>5.1</td>
      <td>3.5</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.9</td>
      <td>3.0</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>2</th>
      <td>4.7</td>
      <td>3.2</td>
      <td>1.3</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4.6</td>
      <td>3.1</td>
      <td>1.5</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5.0</td>
      <td>3.6</td>
      <td>1.4</td>
      <td>0.2</td>
      <td>Iris-setosa</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>145</th>
      <td>6.7</td>
      <td>3.0</td>
      <td>5.2</td>
      <td>2.3</td>
      <td>Iris-virginica</td>
    </tr>
    <tr>
      <th>146</th>
      <td>6.3</td>
      <td>2.5</td>
      <td>5.0</td>
      <td>1.9</td>
      <td>Iris-virginica</td>
    </tr>
    <tr>
      <th>147</th>
      <td>6.5</td>
      <td>3.0</td>
      <td>5.2</td>
      <td>2.0</td>
      <td>Iris-virginica</td>
    </tr>
    <tr>
      <th>148</th>
      <td>6.2</td>
      <td>3.4</td>
      <td>5.4</td>
      <td>2.3</td>
      <td>Iris-virginica</td>
    </tr>
    <tr>
      <th>149</th>
      <td>5.9</td>
      <td>3.0</td>
      <td>5.1</td>
      <td>1.8</td>
      <td>Iris-virginica</td>
    </tr>
  </tbody>
</table>
<p>150 rows × 5 columns</p>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">del</span> iris[<span class="string">'class'</span>]</span><br><span class="line">iris.head()</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>sepal_length</th>
      <th>sepal_width</th>
      <th>petal_length</th>
      <th>petal_width</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>5.1</td>
      <td>3.5</td>
      <td>1.4</td>
      <td>0.2</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.9</td>
      <td>3.0</td>
      <td>1.4</td>
      <td>0.2</td>
    </tr>
    <tr>
      <th>2</th>
      <td>4.7</td>
      <td>3.2</td>
      <td>1.3</td>
      <td>0.2</td>
    </tr>
    <tr>
      <th>3</th>
      <td>4.6</td>
      <td>3.1</td>
      <td>1.5</td>
      <td>0.2</td>
    </tr>
    <tr>
      <th>4</th>
      <td>5.0</td>
      <td>3.6</td>
      <td>1.4</td>
      <td>0.2</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>

    </div>

    
    
    

      
      <div>
        
          <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>
        
      </div>

      <footer class="post-footer">



        
<div>    
 
 
<ul class="post-copyright">
  <li class="post-copyright-author">
      <strong>本文作者：</strong>付文杰
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="/2021/03/31/exercise/" title="exercise">2021/03/31/exercise/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权： </strong>
    本站文章均采用 <a href="http://creativecommons.org/licenses/by-nc-sa/3.0/cn/" rel="external nofollow" target="_blank">CC BY-NC-SA 3.0 CN</a> 许可协议，请勿用于商业，转载注明出处！
  </li>
</ul>

</div>

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
                <a href="/2021/03/30/Untitled%201/" rel="next" title="Untitled 1">
                  <i class="fa fa-chevron-left"></i> Untitled 1
                </a>
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
                <a href="/2021/04/06/matplotlib_1/" rel="prev" title="matplotlib_1">
                  matplotlib_1 <i class="fa fa-chevron-right"></i>
                </a>
            </div>
          </div>
      </footer>
    
  </article>
  
  
  

  </div>


          </div>
          

        </div>
          
  
  <div class="toggle sidebar-toggle">
    <span class="toggle-line toggle-line-first"></span>
    <span class="toggle-line toggle-line-middle"></span>
    <span class="toggle-line toggle-line-last"></span>
    <iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=27588222&auto=1&height=66"></iframe>
  </div>

  <aside class="sidebar">
    <div class="sidebar-inner">

      <ul class="sidebar-nav motion-element">
        <li class="sidebar-nav-toc">
          文章目录
        </li>
        <li class="sidebar-nav-overview">
          站点概览
        </li>
      </ul>

      <!--noindex-->
      <div class="post-toc-wrap sidebar-panel">
      </div>
      <!--/noindex-->

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
  <img class="site-author-image" itemprop="image" alt="付文杰"
    src="/images/headImage.jpg">
  <p class="site-author-name" itemprop="name">付文杰</p>
  <div class="site-description" itemprop="description">兰州交通大学 | 本科生 <br> 信息管理与信息系统</div>
</div>
<div class="site-state-wrap motion-element">
  <nav class="site-state">
      <div class="site-state-item site-state-posts">
          <a href="/archives/">
        
          <span class="site-state-item-count">63</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
      <div class="site-state-item site-state-categories">
            <a href="/categories/">
          
        <span class="site-state-item-count">10</span>
        <span class="site-state-item-name">分类</span></a>
      </div>
      <div class="site-state-item site-state-tags">
            <a href="/tags/">
          
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span></a>
      </div>
  </nav>
</div>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
        <a href="https://github.com/FWj1635387072" title="GitHub &amp;rarr; https:&#x2F;&#x2F;github.com&#x2F;FWj1635387072" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
      <span class="links-of-author-item">
        <a href="/mailto:1635387072@qq.com" title="E-Mail &amp;rarr; mailto:1635387072@qq.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
  </div>
  <div class="cc-license motion-element" itemprop="license">
    <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/null" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
  </div>





      </div>

    </div>
  </aside>
  <div id="sidebar-dimmer"></div>


      </div>
    </main>

    <footer class="footer">
      <div class="footer-inner">
        


<div class="copyright">
  
  &copy; 2019 – 
  <span itemprop="copyrightYear">2021</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">付文杰</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-area-chart"></i>
    </span>
      <span class="post-meta-item-text">站点总字数：</span>
    <span title="站点总字数">210k</span>
    <span class="post-meta-divider">|</span>
    <span class="post-meta-item-icon">
      <i class="fa fa-coffee"></i>
    </span>
      <span class="post-meta-item-text">站点阅读时长 &asymp;</span>
    <span title="站点阅读时长">5:50</span>

  <br>
  <span id="sitetime"></span>

</div>
<script language=javascript>
    function siteTime() {
        window.setTimeout("siteTime()", 1000);
        var seconds = 1000;
        var minutes = seconds * 60;
        var hours = minutes * 60;
        var days = hours * 24;
        var years = days * 365;
        var today = new Date();
        var todayYear = today.getFullYear();
        var todayMonth = today.getMonth() + 1;
        var todayDate = today.getDate();
        var todayHour = today.getHours();
        var todayMinute = today.getMinutes();
        var todaySecond = today.getSeconds();
        /* Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
        year - 作为date对象的年份，为4位年份值
        month - 0-11之间的整数，做为date对象的月份
        day - 1-31之间的整数，做为date对象的天数
        hours - 0(午夜24点)-23之间的整数，做为date对象的小时数
        minutes - 0-59之间的整数，做为date对象的分钟数
        seconds - 0-59之间的整数，做为date对象的秒数
        microseconds - 0-999之间的整数，做为date对象的毫秒数 */
        var t1 = Date.UTC(2019, 11, 7, 17, 50, 00); //北京时间2018-2-13 00:00:00
        var t2 = Date.UTC(todayYear, todayMonth, todayDate, todayHour, todayMinute, todaySecond);
        var diff = t2 - t1;
        var diffYears = Math.floor(diff / years);
        var diffDays = Math.floor((diff / days) - diffYears * 365);
        var diffHours = Math.floor((diff - (diffYears * 365 + diffDays) * days) / hours);
        var diffMinutes = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours) / minutes);
        var diffSeconds = Math.floor((diff - (diffYears * 365 + diffDays) * days - diffHours * hours - diffMinutes * minutes) / seconds);
        document.getElementById("sitetime").innerHTML = "本站已运行 " +diffYears+" 年 "+diffDays + " 天 " + diffHours + " 小时 " + diffMinutes + " 分钟 " + diffSeconds + " 秒";
    }/*因为建站时间还没有一年，就将之注释掉了。需要的可以取消*/
    siteTime();
</script>


        












        
      </div>
    </footer>
  </div>

  
  
  <script color='0,0,255' opacity='0.5' zIndex='-1' count='99' src="/lib/canvas-nest/canvas-nest.min.js"></script>
  <script src="/lib/anime.min.js"></script>
  <script src="/lib/velocity/velocity.min.js"></script>
  <script src="/lib/velocity/velocity.ui.min.js"></script>
<script src="/js/utils.js"></script><script src="/js/motion.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>



  
















  

  

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"model":{"jsonPath":"/live2dw/assets/wanko.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":false},"symbols_count_time":null,"symbols":true,"time":true,"total_symbols":true,"total_time":true,"log":false});</script></body>
</html>
<script type="text/javascript" src="/js/src/clicklove.js"></script>